mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 21:39:48 +01:00
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.
This commit is contained in:
parent
1546e1226a
commit
fc99e6db3e
1 changed files with 2 additions and 1 deletions
|
@ -20,7 +20,8 @@ _emacsfun()
|
||||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||||
then
|
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"
|
cat - > "$tempfile"
|
||||||
_emacsfun --no-wait $tempfile
|
_emacsfun --no-wait $tempfile
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue