diff options
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 149e471a8b..4c224a247f 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -3463,5 +3463,25 @@ __END__ assert_equal(["foo\n", "bar\n", "baz\n"], IO.readlines(t.path)) } end + + def test_closed_stream_in_rescue + 100.times do + assert_nothing_raised(RuntimeError, /frozen IOError/) do + IO.pipe do |r, w| + th = Thread.start {r.close} + r.gets + rescue IOError + # swallow pending exceptions + begin + sleep 0.001 + rescue IOError + retry + end + ensure + th.kill.join + end + end + end + end end end |