aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest/test_io.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-11 11:51:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-11 11:51:39 +0000
commitf3fcd2e4a0b7680fa1ba813b8f7eb257cce41ec7 (patch)
tree9ec9aad1d90ceb6c1b5466f490f28380732d3c0c /bootstraptest/test_io.rb
parent4532c0d81ef7aeb6d75d7bbe099682ef90165e29 (diff)
downloadruby-f3fcd2e4a0b7680fa1ba813b8f7eb257cce41ec7.tar.gz
* 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
Diffstat (limited to 'bootstraptest/test_io.rb')
-rw-r--r--bootstraptest/test_io.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index 07211050a6..c0b906fb4d 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -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