summaryrefslogtreecommitdiff
path: root/test/io/nonblock/test_flush.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-03 04:05:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-03 04:05:20 +0000
commit188881b2a886b7c75559d6774ec1783cf12de950 (patch)
treebed9e999d645a9dfda5cc57ce30d74def0da1465 /test/io/nonblock/test_flush.rb
parent3a08f62b4f5cabd5e279abab17d3e332cfc0e5e0 (diff)
* test/io/nonblock/test_flush.rb (test_flush): try pipe and
socketpair. [ruby-dev:41517] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/io/nonblock/test_flush.rb')
-rw-r--r--test/io/nonblock/test_flush.rb13
1 files changed, 11 insertions, 2 deletions
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