mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
psub: Use explicit command
This would have prevented #6323. While we don't want to pepper `command` everywhere, `psub` is kind of a core thing, so we should try to proof it against common problems.
This commit is contained in:
parent
e18fd3cddb
commit
7527fc265b
1 changed files with 4 additions and 4 deletions
|
@ -28,18 +28,18 @@ function psub --description "Read from stdin into a file and output the filename
|
||||||
set dirname (mktemp -d $tmpdir/.psub.XXXXXXXXXX)
|
set dirname (mktemp -d $tmpdir/.psub.XXXXXXXXXX)
|
||||||
or return
|
or return
|
||||||
set filename $dirname/psub.fifo"$_flag_suffix"
|
set filename $dirname/psub.fifo"$_flag_suffix"
|
||||||
mkfifo $filename
|
command mkfifo $filename
|
||||||
# Note that if we were to do the obvious `cat >$filename &`, we would deadlock
|
# Note that if we were to do the obvious `cat >$filename &`, we would deadlock
|
||||||
# because $filename may be opened before the fork. Use tee to ensure it is opened
|
# because $filename may be opened before the fork. Use tee to ensure it is opened
|
||||||
# after the fork.
|
# after the fork.
|
||||||
tee $filename >/dev/null &
|
command tee $filename >/dev/null &
|
||||||
else if test -z "$_flag_suffix"
|
else if test -z "$_flag_suffix"
|
||||||
set filename (mktemp $tmpdir/.psub.XXXXXXXXXX)
|
set filename (mktemp $tmpdir/.psub.XXXXXXXXXX)
|
||||||
cat >$filename
|
command cat >$filename
|
||||||
else
|
else
|
||||||
set dirname (mktemp -d $tmpdir/.psub.XXXXXXXXXX)
|
set dirname (mktemp -d $tmpdir/.psub.XXXXXXXXXX)
|
||||||
set filename "$dirname/psub$_flag_suffix"
|
set filename "$dirname/psub$_flag_suffix"
|
||||||
cat >$filename
|
command cat >$filename
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write filename to stdout
|
# Write filename to stdout
|
||||||
|
|
Loading…
Reference in a new issue