diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-29 05:33:15 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-29 05:33:15 +0000 |
commit | 95f0f27dd04c902932c0f64e1e2cc20ab5974885 (patch) | |
tree | 923bc81ac83ac4bc765a067c9ab9a2de59422781 /win32/win32.c | |
parent | dd4c394564d05f6d70afcf78671b62350c2ab179 (diff) |
* win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the
fd is console or not, just like rb_w32_write_console().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index f55fe9c278..35cb686d1c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5576,11 +5576,13 @@ rb_w32_uchmod(const char *path, int mode) int rb_w32_isatty(int fd) { + DWORD mode; + // validate fd by using _get_osfhandle() because we cannot access _nhandle if (_get_osfhandle(fd) == -1) { return 0; } - if (!(_osfile(fd) & FDEV)) { + if (!GetConsoleMode((HANDLE)_osfhnd(fd), &mode)) { errno = ENOTTY; return 0; } |