From 7527fc265bafb9146c7924d591c43df5fbedd024 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 14 Nov 2019 17:13:39 +0100 Subject: [PATCH] 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. --- share/functions/psub.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/functions/psub.fish b/share/functions/psub.fish index 8c8a7eac8..c88ad89bb 100644 --- a/share/functions/psub.fish +++ b/share/functions/psub.fish @@ -28,18 +28,18 @@ function psub --description "Read from stdin into a file and output the filename set dirname (mktemp -d $tmpdir/.psub.XXXXXXXXXX) or return 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 # because $filename may be opened before the fork. Use tee to ensure it is opened # after the fork. - tee $filename >/dev/null & + command tee $filename >/dev/null & else if test -z "$_flag_suffix" set filename (mktemp $tmpdir/.psub.XXXXXXXXXX) - cat >$filename + command cat >$filename else set dirname (mktemp -d $tmpdir/.psub.XXXXXXXXXX) set filename "$dirname/psub$_flag_suffix" - cat >$filename + command cat >$filename end # Write filename to stdout