diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index 59310eaf14..4d647f9d8e 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5057,6 +5057,7 @@ rb_w32_read(int fd, void *buf, size_t size) size_t ret; OVERLAPPED ol, *pol = NULL; BOOL isconsole; + BOOL islineinput; int start = 0; if (is_socket(sock)) @@ -5081,6 +5082,11 @@ rb_w32_read(int fd, void *buf, size_t size) ret = 0; isconsole = is_console(_osfhnd(fd)); + if(isconsole){ + DWORD mode; + GetConsoleMode((HANDLE)_osfhnd(fd),&mode); + islineinput = (mode & ENABLE_LINE_INPUT) != 0; + } retry: /* get rid of console reading bug */ if (isconsole) { @@ -5183,7 +5189,7 @@ rb_w32_read(int fd, void *buf, size_t size) ret += read; if (read >= len) { buf = (char *)buf + read; - if (!(isconsole && len == 1 && *((char *)buf - 1) == '\n') && size > 0) + if (!(isconsole && len == 1 && (!islineinput || *((char *)buf - 1) == '\n')) && size > 0) goto retry; } if (read == 0) |