mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Use the newly fixed test -t
in isatty
Removes a weird dependency on the test command.
This commit is contained in:
parent
709e91c1e6
commit
e86a31f6d4
|
@ -25,9 +25,5 @@ function isatty -d "Tests if a file descriptor is a tty"
|
||||||
set fd $argv[1]
|
set fd $argv[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use `command test` because `builtin test` doesn't open the regular fd's.
|
test -t "$fd"
|
||||||
# See https://github.com/fish-shell/fish-shell/issues/1228
|
|
||||||
# Too often `command test` is some bogus Go binary, I don't know why. Use [ because
|
|
||||||
# it's less likely to be something surprising. See #5665
|
|
||||||
command [ -t "$fd" ]
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,3 +57,11 @@ sendline("t </dev/null")
|
||||||
expect_str("stdout")
|
expect_str("stdout")
|
||||||
expect_str("stderr")
|
expect_str("stderr")
|
||||||
expect_prompt()
|
expect_prompt()
|
||||||
|
|
||||||
|
sendline("isatty stdin && echo yes")
|
||||||
|
expect_str("yes")
|
||||||
|
expect_prompt()
|
||||||
|
|
||||||
|
sendline("cat </dev/null | isatty stdin || echo no")
|
||||||
|
expect_str("no")
|
||||||
|
expect_prompt()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user