diff options
author | tarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-06 15:29:45 +0000 |
---|---|---|
committer | tarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-06 15:29:45 +0000 |
commit | 88ab39f6ab4f2a81d6e100513cafc7424d8f6531 (patch) | |
tree | 0ec07c83864558875113825c209eaa22f50a9cd0 | |
parent | 03693cd590edd3dade1142e9409f93de8f3593b8 (diff) | |
download | ruby-88ab39f6ab4f2a81d6e100513cafc7424d8f6531.tar.gz |
* win32/win32.c (rb_w32_read): fixed more for readline, and so on. [ruby-core:33511]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win32/win32.c | 8 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Tue Dec 7 00:27:14 2010 Masaya Tarui <tarui@ruby-lnag.org> + + * win32/win32.c (rb_w32_read): fixed more for readline, + and so on. [ruby-core:33511] + Mon Dec 6 23:18:22 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * test/mkmf/base.rb (TestMkmf#setup): run quietly. diff --git a/win32/win32.c b/win32/win32.c index 590700bceb..1b7bf96eb0 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5028,6 +5028,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)) @@ -5052,6 +5053,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) { @@ -5154,7 +5160,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) |