mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 22:04:27 +08:00
Fix funced's tmpfile generation on OSX
OSX mktemp... isn't great, so work around that fact.
This commit is contained in:
parent
60317190bd
commit
5accc7c6c5
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user