summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-29 05:33:15 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-29 05:33:15 +0000
commit95f0f27dd04c902932c0f64e1e2cc20ab5974885 (patch)
tree923bc81ac83ac4bc765a067c9ab9a2de59422781
parentdd4c394564d05f6d70afcf78671b62350c2ab179 (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
-rw-r--r--ChangeLog5
-rw-r--r--win32/win32.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 40dc92c2df..b974445182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Nov 29 14:31:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the
+ fd is console or not, just like rb_w32_write_console().
+
Mon Nov 29 14:19:40 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* include/ruby/win32.h (rb_w32_write_console): wrong prototype.
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;
}