mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
1ff181cf8c
commit
c1903a9f17
1 changed files with 2 additions and 3 deletions
|
@ -1069,13 +1069,12 @@ class TestIO < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_read_nonblock_with_not_empty_buffer
|
def test_read_nonblock_with_not_empty_buffer
|
||||||
skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
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.write "foob"
|
||||||
w.close
|
w.close
|
||||||
end, proc do |r|
|
|
||||||
r.read_nonblock(5, s = "01234567")
|
r.read_nonblock(5, s = "01234567")
|
||||||
assert_equal("foob", s)
|
assert_equal("foob", s)
|
||||||
end)
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_nonblock_error
|
def test_read_nonblock_error
|
||||||
|
|
Loading…
Add table
Reference in a new issue