* 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
This commit is contained in:
parent
dd4c394564
commit
95f0f27dd0
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user