diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-24 14:52:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-24 14:52:07 +0000 |
commit | 54fa9f9e1378aa7ef925f86ae776f3d6843eeab3 (patch) | |
tree | 54db8eb40f8c2ec84196eaab46c3ca9fc7bf90cb /test | |
parent | 7bf450d0c30e2617fae9c54e977615f68dfac86e (diff) |
eval.c: copy special exception
* eval.c (setup_exception): make unfrozen copy of special
exception before setting up a cause.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 |