mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 03:51:14 -03:00
return to psub --file being the default
The recent change to switch `psub` to use `argparse` caused it to use a fifo by default because it inadvertently fixed a long standing bug in the fish script. This changes the behavior back to `psub --file` being the default behavior and introduces a `--fifo` flag. It also updates the documentation to make it clearer when and why `--fifo` mode should not be used. Fixes #4222
This commit is contained in:
49
tests/psub.in
Normal file
49
tests/psub.in
Normal file
@@ -0,0 +1,49 @@
|
||||
# Test psub behavior
|
||||
set -l filename (echo foo | psub --testing)
|
||||
test -f $filename
|
||||
or echo 'psub is not a regular file' >&2
|
||||
rm $filename
|
||||
|
||||
set -l filename (echo foo | psub --testing --file)
|
||||
test -f $filename
|
||||
or echo 'psub is not a regular file' >&2
|
||||
rm $filename
|
||||
|
||||
set -l filename (echo foo | psub --testing --fifo)
|
||||
test -p $filename
|
||||
or echo 'psub is not a fifo' >&2
|
||||
rm $filename
|
||||
|
||||
cat (echo foo | psub)
|
||||
cat (echo bar | psub --fifo)
|
||||
cat (echo baz | psub)
|
||||
|
||||
set -l filename (echo foo | psub)
|
||||
if test -e $filename
|
||||
echo 'psub file was not deleted'
|
||||
else
|
||||
echo 'psub file was deleted'
|
||||
end
|
||||
|
||||
# The --file flag is the default behavior.
|
||||
if count (echo foo | psub -s .cc | grep -o '\.cc$') >/dev/null
|
||||
echo 'psub filename ends with .cc'
|
||||
else
|
||||
echo 'psub filename does not end with .cc'
|
||||
end
|
||||
|
||||
# Make sure we get the same result if we explicitly ask for a temp file.
|
||||
if count (echo foo | psub -f -s .cc | grep -o '\.cc$') >/dev/null
|
||||
echo 'psub filename ends with .cc'
|
||||
else
|
||||
echo 'psub filename does not end with .cc'
|
||||
end
|
||||
|
||||
set -l filename (echo foo | psub -s .fish)
|
||||
if test -e (dirname $filename)
|
||||
echo 'psub directory was not deleted'
|
||||
else
|
||||
echo 'psub directory was deleted'
|
||||
end
|
||||
|
||||
diff -q (__fish_print_help psub | psub) (psub -hs banana | psub)
|
||||
Reference in New Issue
Block a user