From 5accc7c6c5b2234998d1a88de2dfeb1057bd5507 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 23 May 2016 00:49:09 +0200 Subject: Fix funced's tmpfile generation on OSX OSX mktemp... isn't great, so work around that fact. --- share/functions/funced.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/functions/funced.fish b/share/functions/funced.fish index 6439e53f..8f62e96b 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -87,7 +87,11 @@ function funced --description 'Edit function definition' return 0 end - set tmpname (mktemp -t fish_funced.XXXXXXXXXX.fish) + # OSX mktemp is rather restricted - no suffix, no way to automatically use TMPDIR + # Create a directory so we can use a ".fish" suffix for the file - makes editors pick up that it's a fish file + set -q TMPDIR; or set -l TMPDIR /tmp + set -l tmpdir (mktemp -d $TMPDIR/fish.XXXXXX) + set -l tmpname $tmpdir/$funcname.fish if functions -q -- $funcname functions -- $funcname > $tmpname @@ -120,6 +124,6 @@ function funced --description 'Edit function definition' break end set -l stat $status - rm -f $tmpname >/dev/null + rm -rf $tmpdir >/dev/null return $stat end -- cgit v1.2.3