Use the newly fixed test -t in isatty

Removes a weird dependency on the test command.
This commit is contained in:
Fabian Homborg 2020-09-16 20:58:07 +02:00
parent 709e91c1e6
commit e86a31f6d4
2 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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()