mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 02:27:28 +08:00
isatty: use command test instead of redirections
Adds a fork but can't use builtin test yet. Closes #1870.
This commit is contained in:
parent
66acd17bc0
commit
597dda5a4b
|
@ -8,7 +8,7 @@ function isatty -d "Tests if a file descriptor is a tty"
|
|||
__fish_print_help isatty
|
||||
return 0
|
||||
|
||||
case stdin
|
||||
case stdin ''
|
||||
set fd 0
|
||||
|
||||
case stdout
|
||||
|
@ -23,6 +23,8 @@ function isatty -d "Tests if a file descriptor is a tty"
|
|||
end
|
||||
end
|
||||
|
||||
eval "tty 0>&$fd >/dev/null"
|
||||
# Use `command test` because `builtin test` doesn't open the regular fd's.
|
||||
# See https://github.com/fish-shell/fish-shell/issues/1228
|
||||
command test -t "$fd"
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user