mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_read): workaround for console reading troubles.
fixed [ruby-core:33511] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7eadd51dfe
commit
6f3225f698
2 changed files with 12 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 2 13:41:43 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_read): workaround for console reading troubles.
|
||||
fixed [ruby-core:33511]
|
||||
|
||||
Thu Dec 2 13:10:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/uri/common.rb (URI.encode_www_form):
|
||||
|
|
|
@ -5045,6 +5045,7 @@ 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;
|
||||
}
|
||||
|
@ -5055,7 +5056,7 @@ rb_w32_read(int fd, void *buf, size_t size)
|
|||
/* get rid of console reading bug */
|
||||
if (isconsole) {
|
||||
if (start)
|
||||
len = 1;
|
||||
len = min(16*1024, size);
|
||||
else {
|
||||
len = 0;
|
||||
start = 1;
|
||||
|
@ -5151,11 +5152,14 @@ rb_w32_read(int fd, void *buf, size_t size)
|
|||
}
|
||||
|
||||
ret += read;
|
||||
if (read == len) {
|
||||
if (read >= len) {
|
||||
buf = (char *)buf + len;
|
||||
if (size > 0)
|
||||
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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue