mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_io.rb: use assert_separately
* test/ruby/test_io.rb (test_cross_thread_close_stdio): use assert_separately instead of separated fork and assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ef7bd1b167
commit
4f95e22d9c
1 changed files with 5 additions and 12 deletions
|
@ -2261,25 +2261,18 @@ End
|
|||
end
|
||||
|
||||
def test_cross_thread_close_stdio
|
||||
with_pipe do |r,w|
|
||||
pid = fork do
|
||||
assert_separately([], <<-'end;')
|
||||
IO.pipe do |r,w|
|
||||
$stdin.reopen(r)
|
||||
r.close
|
||||
read_thread = Thread.new do
|
||||
begin
|
||||
$stdin.read(1)
|
||||
rescue => e
|
||||
e
|
||||
end
|
||||
$stdin.read(1)
|
||||
end
|
||||
sleep(0.1) until read_thread.stop?
|
||||
$stdin.close
|
||||
read_thread.join
|
||||
exit(IOError === read_thread.value)
|
||||
assert_raise(IOError) {read_thread.join}
|
||||
end
|
||||
assert Process.waitpid2(pid)[1].success?
|
||||
end
|
||||
rescue NotImplementedError
|
||||
end;
|
||||
end
|
||||
|
||||
def test_open_mode
|
||||
|
|
Loading…
Reference in a new issue