diff --git a/test/io/nonblock/test_flush.rb b/test/io/nonblock/test_flush.rb index b031c71bf8..8c93c814a3 100644 --- a/test/io/nonblock/test_flush.rb +++ b/test/io/nonblock/test_flush.rb @@ -7,9 +7,14 @@ end class TestIONonblock < Test::Unit::TestCase def test_flush - flush_test(*IO.pipe) or - (require 'socket'; flush_test(*Socket.pair(:INET, :STREAM))) or - skip "nonblocking IO did not work" + IO.pipe {|r, w| + return if flush_test(r, w) + } + require 'socket'; + Socket.pair(:INET, :STREAM) {|s1, s2| + return if flush_test(s1, s2) + } + skip "nonblocking IO did not work" end def flush_test(r, w)