mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 23:11:14 -03:00
allow psub --fifo --suffix ...
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function psub --description "Read from stdin into a file and output the filename. Remove the file when the command that called psub exits."
|
||||
set -l options -x 'f,F' -x 'F,s' h/help f/file F/fifo 's/suffix=' T-testing
|
||||
set -l options -x 'f,F' h/help f/file F/fifo 's/suffix=' T-testing
|
||||
argparse -n psub --max-args=0 $options -- $argv
|
||||
or return
|
||||
|
||||
|
||||
@@ -49,6 +49,17 @@ else
|
||||
end
|
||||
#CHECK: psub filename ends with .cc
|
||||
|
||||
# Fifo is allowed to have a suffix as well
|
||||
# hack: the background write that psub performs may block
|
||||
# until someone opens the fifo for reading. So make sure we
|
||||
# actually read it.
|
||||
if cat (echo foo | psub -F -s .cc | string match -e -r '\.fifo\.cc$') >/dev/null
|
||||
echo 'psub pipe name ends with .cc'
|
||||
else
|
||||
echo 'psub pipe name does not end with .cc'
|
||||
end
|
||||
#CHECK: psub pipe name ends with .cc
|
||||
|
||||
set -l filename (echo foo | psub -s .fish)
|
||||
if test -e (dirname $filename)
|
||||
echo 'psub directory was not deleted'
|
||||
|
||||
Reference in New Issue
Block a user