diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-23 10:49:03 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-23 10:49:03 +0000 |
commit | a46abacacd00e7f9940bae7680383df0d2684f79 (patch) | |
tree | 3b005dfc4e9aef90a0bc4f8fa06e1e21361bb35c /win32 | |
parent | c9d697ab7842e5672579cfb0e9bd0594ff95fe19 (diff) |
merges r29980,r30017,r30018,r30019 and r30020 from trunk into ruby_1_9_2.
--
* win32/win32.c (rb_w32_read): read only 1 byte at once on console.
workaround of Windows bug. see [ruby-core:33460].
this is not the final solution.
--
* win32/win32.c (rb_w32_read): workaround for console reading troubles.
fixed [ruby-core:33511]
--
* win32/win32.c (rb_w32_read): rollback debug code of previous commit.
--
* win32/win32.c (rb_w43_read): more fix. [ruby-core:33513]
--
* ChangeLog: typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/win32/win32.c b/win32/win32.c index 2216f45d54..59310eaf14 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5056,6 +5056,7 @@ rb_w32_read(int fd, void *buf, size_t size) size_t len; size_t ret; OVERLAPPED ol, *pol = NULL; + BOOL isconsole; int start = 0; if (is_socket(sock)) @@ -5073,16 +5074,18 @@ rb_w32_read(int fd, void *buf, size_t size) MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock))); if (!size || _osfile(fd) & FEOFLAG) { + _set_osflags(fd, _osfile(fd) & ~FEOFLAG); MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock)); return 0; } ret = 0; + isconsole = is_console(_osfhnd(fd)); retry: /* get rid of console reading bug */ - if (is_console(_osfhnd(fd))) { + if (isconsole) { if (start) - len = min(16 * 1024, size); + len = 1; else { len = 0; start = 1; @@ -5178,11 +5181,14 @@ rb_w32_read(int fd, void *buf, size_t size) } ret += read; - if (read == len) { - buf = (char *)buf + len; - if (size > 0) + if (read >= len) { + buf = (char *)buf + read; + if (!(isconsole && len == 1 && *((char *)buf - 1) == '\n') && size > 0) goto retry; } + if (read == 0) + _set_osflags(fd, _osfile(fd) | FEOFLAG); + MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock)); |