diff options
author | Eric Dobbs <eric@dobbse.net> | 2019-11-06 12:25:36 -0700 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2019-11-06 20:25:36 +0100 |
commit | fc99e6db3e917a0556afe56273c901220c8105a9 (patch) | |
tree | 3ed9f87e137630088147cdadf1853518d05c546d /plugins/emacs/emacsclient.sh | |
parent | 1546e1226a7b739776bda43f264b221739ba0397 (diff) | |
download | zsh-fc99e6db3e917a0556afe56273c901220c8105a9.tar.gz zsh-fc99e6db3e917a0556afe56273c901220c8105a9.tar.bz2 zsh-fc99e6db3e917a0556afe56273c901220c8105a9.zip |
emacs: support BSD mktemp in emacsclient.sh (#8351)
Piping stdin to emacs alias on MacOS was breaking (--tmpdir is not
supported in BSD flavored mktemp).
Tested in MacOS 10.14 and debian:buster to confirm it still works in
linux.
Diffstat (limited to 'plugins/emacs/emacsclient.sh')
-rwxr-xr-x | plugins/emacs/emacsclient.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 26b28d495..0aa8d6f40 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -20,7 +20,8 @@ _emacsfun() # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) if [ "$#" -ge "2" -a "$2" = "-" ] then - tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)" + tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \ + || mktemp -t emacs-stdin-$USER)" # support BSD mktemp cat - > "$tempfile" _emacsfun --no-wait $tempfile else |