diff --git a/ChangeLog b/ChangeLog index 4ebd95ff78..e6a1558648 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jun 3 13:05:15 2010 Nobuyoshi Nakada + + * test/io/nonblock/test_flush.rb (test_flush): try pipe and + socketpair. [ruby-dev:41517] + Thu Jun 3 09:36:43 2010 NAKAMURA Usaku * ext/dl/dl.h (DLSTACK_TYPE): type of stack is same as VALUE. diff --git a/test/io/nonblock/test_flush.rb b/test/io/nonblock/test_flush.rb index 2217dbcec9..5dc55a67fe 100644 --- a/test/io/nonblock/test_flush.rb +++ b/test/io/nonblock/test_flush.rb @@ -7,8 +7,17 @@ end class TestIONonblock < Test::Unit::TestCase def test_flush - r,w = IO.pipe - w.nonblock = true + flush_test(*IO.pipe) or + (require 'socket'; flush_test(*Socket.pair(:INET, :STREAM))) or + skip "nonblocking IO did not work" + end + + def flush_test(r, w) + begin + w.nonblock = true + rescue Errno::EBADF + return false + end w.sync = false w << "b" w.flush