diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-10 10:42:19 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-10 10:42:19 +0000 |
commit | fd9f6bde957ce681fed49182be02124ecc89b362 (patch) | |
tree | ad4a0c12e80ad4ca7c60d6dd8c18be960d5dde8c /io.c | |
parent | 6ccf3d68c21c2eabefe80f9ff1f7b5296a9ddfd2 (diff) |
* win32/win32.c, include/win32/win32.h (rb_w32_set_nonblock): new
function to support nonblock-mode of pipes.
* win32/win32.c (rb_w32_read): nonblock-mode pipe returns ERROR_NO_DATA
if there is no data, but also returns it if remote-end is closed.
* win32/win32.c (rb_w32_write): if cannot to write any data, it may be
blocking.
* io.c (rb_io_set_nonblock): use rb_w32_set_nonblock for Windows.
* ext/io/nonblock/nonblock.c (rb_io_nonblock_set): use ruby's API when
setting nonblock-mode.
* test/ruby/test_io.rb: test nonblock pipes on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -2474,6 +2474,11 @@ read_all(rb_io_t *fptr, long siz, VALUE str) void rb_io_set_nonblock(rb_io_t *fptr) { +#ifdef _WIN32 + if (rb_w32_set_nonblock(fptr->fd) != 0) { + rb_sys_fail_path(fptr->pathv); + } +#else int oflags; #ifdef F_GETFL oflags = fcntl(fptr->fd, F_GETFL); @@ -2489,6 +2494,7 @@ rb_io_set_nonblock(rb_io_t *fptr) rb_sys_fail_path(fptr->pathv); } } +#endif } void |