mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_io_wait_readable, rb_io_wait_writable): check if the file
descriptor is closed. * thread.c (rb_thread_wait_fd_rw): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4532c0d81e
commit
f3fcd2e4a0
5 changed files with 53 additions and 16 deletions
|
@ -73,3 +73,22 @@ assert_equal 'ok', %q{
|
|||
assert_normal_exit %q{
|
||||
ARGF.set_encoding "foo"
|
||||
}
|
||||
|
||||
50.times do
|
||||
assert_normal_exit %q{
|
||||
at_exit { p :foo }
|
||||
|
||||
megacontent = "abc" * 12345678
|
||||
File.open("megasrc", "w") {|f| f << megacontent }
|
||||
|
||||
Thread.new { sleep rand*0.2; Process.kill(:INT, $$) }
|
||||
|
||||
r1, w1 = IO.pipe
|
||||
r2, w2 = IO.pipe
|
||||
t1 = Thread.new { w1 << megacontent; w1.close }
|
||||
t2 = Thread.new { r2.read }
|
||||
IO.copy_stream(r1, w2) rescue nil
|
||||
r2.close; w2.close
|
||||
r1.close; w1.close
|
||||
}, '', ["INT"] or break
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue