* win32/win32.c (rb_w32_read): call ReadFile() with len = 0 before
reading really on console, because the first ReadFile() call after PeekConsoleInput() always returns broken data. (Windows's bug). [ruby-core:29018] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
37f75ad0c4
commit
51077c2c22
@ -1,3 +1,10 @@
|
|||||||
|
Thu May 27 22:34:27 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (rb_w32_read): call ReadFile() with len = 0 before
|
||||||
|
reading really on console, because the first ReadFile() call after
|
||||||
|
PeekConsoleInput() always returns broken data. (Windows's bug).
|
||||||
|
[ruby-core:29018]
|
||||||
|
|
||||||
Thu May 27 12:42:23 2010 Akinori MUSHA <knu@iDaemons.org>
|
Thu May 27 12:42:23 2010 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* LGPL: Removed. We no longer have LGPL'd source files in our
|
* LGPL: Removed. We no longer have LGPL'd source files in our
|
||||||
|
@ -5032,6 +5032,7 @@ rb_w32_read(int fd, void *buf, size_t size)
|
|||||||
size_t len;
|
size_t len;
|
||||||
size_t ret;
|
size_t ret;
|
||||||
OVERLAPPED ol, *pol = NULL;
|
OVERLAPPED ol, *pol = NULL;
|
||||||
|
int start = 0;
|
||||||
|
|
||||||
if (is_socket(sock))
|
if (is_socket(sock))
|
||||||
return rb_w32_recv(fd, buf, size, 0);
|
return rb_w32_recv(fd, buf, size, 0);
|
||||||
@ -5054,8 +5055,17 @@ rb_w32_read(int fd, void *buf, size_t size)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
retry:
|
retry:
|
||||||
/* get rid of console writing bug */
|
/* get rid of console reading bug */
|
||||||
len = (_osfile(fd) & FDEV) ? min(16 * 1024, size) : size;
|
if (is_console(_osfhnd(fd))) {
|
||||||
|
if (start)
|
||||||
|
len = min(16 * 1024, size);
|
||||||
|
else {
|
||||||
|
len = 0;
|
||||||
|
start = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
len = size;
|
||||||
size -= len;
|
size -= len;
|
||||||
|
|
||||||
/* if have cancel_io, use Overlapped I/O */
|
/* if have cancel_io, use Overlapped I/O */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user