aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/isatty.fish
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-02-01 18:15:10 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-02-01 18:18:34 +0800
commit597dda5a4b1a774ec8185c5f09213c6df3ed195b (patch)
treeb8c211f4606b130800eca4ebeac47176db827b39 /share/functions/isatty.fish
parent66acd17bc02a8b3ff6292f1fc499b2712edf91f3 (diff)
isatty: use command test instead of redirections
Adds a fork but can't use builtin test yet. Closes #1870.
Diffstat (limited to 'share/functions/isatty.fish')
-rw-r--r--share/functions/isatty.fish6
1 files changed, 4 insertions, 2 deletions
diff --git a/share/functions/isatty.fish b/share/functions/isatty.fish
index d4f2c43e..df819925 100644
--- a/share/functions/isatty.fish
+++ b/share/functions/isatty.fish
@@ -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