From fd9f6bde957ce681fed49182be02124ecc89b362 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 10 Nov 2014 10:42:19 +0000 Subject: * 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 --- ext/io/nonblock/nonblock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/io/nonblock/nonblock.c b/ext/io/nonblock/nonblock.c index ccd8728a31..2c5c298126 100644 --- a/ext/io/nonblock/nonblock.c +++ b/ext/io/nonblock/nonblock.c @@ -79,7 +79,10 @@ rb_io_nonblock_set(VALUE io, VALUE nb) { rb_io_t *fptr; GetOpenFile(io, fptr); - io_nonblock_set(fptr->fd, io_nonblock_mode(fptr->fd), RTEST(nb)); + if (RTEST(nb)) + rb_io_set_nonblock(fptr); + else + io_nonblock_set(fptr->fd, io_nonblock_mode(fptr->fd), RTEST(nb)); return io; } -- cgit v1.2.3