mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00: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
1 changed files with 4 additions and 2 deletions
|
@ -8,7 +8,7 @@ function isatty -d "Tests if a file descriptor is a tty"
|
||||||
__fish_print_help isatty
|
__fish_print_help isatty
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
case stdin
|
case stdin ''
|
||||||
set fd 0
|
set fd 0
|
||||||
|
|
||||||
case stdout
|
case stdout
|
||||||
|
@ -23,6 +23,8 @@ function isatty -d "Tests if a file descriptor is a tty"
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue