summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/win32/win32.c b/win32/win32.c
index eb062f5c03..872fcd013c 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4395,11 +4395,15 @@ rb_w32_read(int fd, void *buf, size_t size)
if (!GetOverlappedResult((HANDLE)_osfhnd(fd), &ol, &read, TRUE) &&
(err = GetLastError()) != ERROR_HANDLE_EOF) {
- errno = map_errno(err);
+ int ret = 0;
+ if (err != ERROR_BROKEN_PIPE) {
+ errno = map_errno(err);
+ ret = -1;
+ }
CloseHandle(ol.hEvent);
cancel_io((HANDLE)_osfhnd(fd));
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
- return -1;
+ return ret;
}
}
}