summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c4
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;
}