summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorshirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-28 00:51:43 +0000
committershirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-28 00:51:43 +0000
commita65f6649dd71136ada6adabf65d3aa5e2b9bee36 (patch)
tree74b860889d2bd2610bd60f8431478007e3eba871 /win32
parentbb65920642330cb375b3649496dca95e27aee04b (diff)
* win32/win32.c (rb_w32_read): fix an issue that $stdin.read doesn't
terminate by CTRL-C on Windows. [ruby-dev:45149] [Bug #5812] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 9922fa5b14..744c61489e 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5575,6 +5575,10 @@ rb_w32_read(int fd, void *buf, size_t size)
}
}
}
+ else {
+ err = GetLastError();
+ errno = map_errno(err);
+ }
if (pol) {
CloseHandle(ol.hEvent);
@@ -5591,7 +5595,8 @@ rb_w32_read(int fd, void *buf, size_t size)
ret += read;
if (read >= len) {
buf = (char *)buf + read;
- if (!(isconsole && len == 1 && (!islineinput || *((char *)buf - 1) == '\n')) && size > 0)
+ if (err != ERROR_OPERATION_ABORTED &&
+ !(isconsole && len == 1 && (!islineinput || *((char *)buf - 1) == '\n')) && size > 0)
goto retry;
}
if (read == 0)