diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-19 02:49:48 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-19 02:49:48 +0000 |
commit | c1903a9f17ebda5c7c6d94e634d90e7ee0f98a72 (patch) | |
tree | af806cba544b8333a93e78086248894e87c17b37 | |
parent | 1ff181cf8c8bc2226d947bbb04d7129767f6ccf6 (diff) | |
download | ruby-c1903a9f17ebda5c7c6d94e634d90e7ee0f98a72.tar.gz |
Fix multithread issue in the test of r35391
pipe() uses threads and its reader thread may work before the writer
writes "foob". On such case, the reader will raise error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_io.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index d984252cb5..ebf9b760dd 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1069,13 +1069,12 @@ class TestIO < Test::Unit::TestCase def test_read_nonblock_with_not_empty_buffer skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM - pipe(proc do |w| + with_pipe {|r, w| w.write "foob" w.close - end, proc do |r| r.read_nonblock(5, s = "01234567") assert_equal("foob", s) - end) + } end def test_read_nonblock_error |