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 | db0afc5d2d22958d7c0ccdcf9c7ecf94af16b41c (patch) | |
tree | 54db8eb40f8c2ec84196eaab46c3ca9fc7bf90cb /test/ruby | |
parent | f852ce8969fc93f8330b25ac49a45b47d83805d6 (diff) | |
download | ruby-db0afc5d2d22958d7c0ccdcf9c7ecf94af16b41c.tar.gz |
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/ruby')
-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 |