mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
backport r28368:
* eval_error.c (error_print): clear raised_flag while error-printing to avoid hang. [ruby-core:27608] * test/ruby/test_beginendblock.rb (test_endblock_raise): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a7a26fe56b
commit
71fecd39f8
3 changed files with 29 additions and 1 deletions
|
@ -108,4 +108,20 @@ EOW
|
|||
assert_nil $?.exitstatus
|
||||
assert_equal Signal.list["INT"], $?.termsig
|
||||
end
|
||||
|
||||
def test_endblock_raise
|
||||
ruby = EnvUtil.rubybin
|
||||
out = IO.popen(
|
||||
[ruby,
|
||||
'-e', 'class C; def write(x); puts x; STDOUT.flush; sleep 0.01; end; end',
|
||||
'-e', '$stderr = C.new',
|
||||
'-e', 'END {raise "e1"}; END {puts "e2"}',
|
||||
'-e', 'END {raise "e3"}; END {puts "e4"}',
|
||||
'-e', 'END {raise "e5"}; END {puts "e6"}']) {|f|
|
||||
Thread.new {sleep 5; Process.kill :KILL, f.pid}
|
||||
f.read
|
||||
}
|
||||
assert_match(/e1/, out)
|
||||
assert_match(/e6/, out)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue