mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 21:21:15 -03:00
builtins to allow stdin to be closed
Prior to this fix, if stdin were explicitly closed, then builtins would
silently fail. For example:
count <&-
would just fail with status 1. Remove this limitation and allow each
builtin to handle a closed stdin how it sees fit.
This commit is contained in:
@@ -50,7 +50,7 @@ test -f $tmpdir/file.txt && echo "File exists" || echo "File does not exist"
|
||||
|
||||
function foo
|
||||
if set -q argv[1]
|
||||
foo > $argv[1]
|
||||
foo >$argv[1]
|
||||
end
|
||||
echo foo
|
||||
end
|
||||
@@ -89,6 +89,19 @@ begin
|
||||
end 2>| cat >/dev/null
|
||||
#CHECK: is_stdout
|
||||
|
||||
# Verify builtin behavior with closed stdin.
|
||||
# count silently ignores closed stdin, others may print an error.
|
||||
true <&-
|
||||
echo $status
|
||||
#CHECK: 0
|
||||
test -t 0 <&-
|
||||
echo $status
|
||||
#CHECK: 1
|
||||
read abc <&-
|
||||
#CHECKERR: read: stdin is closed
|
||||
|
||||
|
||||
|
||||
# "Verify that pipes don't conflict with fd redirections"
|
||||
# This code is very similar to eval. We go over a bunch of fads
|
||||
# to make it likely that we will nominally conflict with a pipe
|
||||
|
||||
Reference in New Issue
Block a user