ruby-changes:29153
From: nobu <ko1@a...>
Date: Mon, 10 Jun 2013 15:35:47 +0900 (JST)
Subject: [ruby-changes:29153] nobu:r41205 (trunk): eval_error.c: restore errinfo
nobu 2013-06-10 15:35:37 +0900 (Mon, 10 Jun 2013) New Revision: 41205 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41205 Log: eval_error.c: restore errinfo * eval_error.c (error_print): restore errinfo for the case new excecption raised while printing the message. [ruby-core:55365] [Bug #8501] Modified files: trunk/ChangeLog trunk/eval_error.c trunk/test/ruby/test_beginendblock.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41204) +++ ChangeLog (revision 41205) @@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Mon Jun 10 15:34:26 2013 Nobuyoshi Nakada <nobu@r...> +Mon Jun 10 15:35:34 2013 Nobuyoshi Nakada <nobu@r...> + + * eval_error.c (error_print): restore errinfo for the case new + excecption raised while printing the message. [ruby-core:55365] + [Bug #8501] * eval_error.c (error_print): reduce calling setjmp. Index: eval_error.c =================================================================== --- eval_error.c (revision 41204) +++ eval_error.c (revision 41205) @@ -197,6 +197,7 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L197 } error: TH_POP_TAG(); + th->errinfo = errinfo; rb_thread_raised_set(th, raised_flag); } Index: test/ruby/test_beginendblock.rb =================================================================== --- test/ruby/test_beginendblock.rb (revision 41204) +++ test/ruby/test_beginendblock.rb (revision 41205) @@ -85,8 +85,22 @@ EOW https://github.com/ruby/ruby/blob/trunk/test/ruby/test_beginendblock.rb#L85 '-e', 'raise %[SomethingElse]']) {|f| f.read } + status = $? assert_match(/SomethingBad/, out, "[ruby-core:9675]") assert_match(/SomethingElse/, out, "[ruby-core:9675]") + assert_not_predicate(status, :success?) + end + + def test_exitcode_in_at_exit + bug8501 = '[ruby-core:55365] [Bug #8501]' + out = IO.popen([ruby, '-e', 'STDERR.reopen(STDOUT)', + '-e', 'o = Object.new; def o.inspect; raise "[Bug #8501]"; end', + '-e', 'at_exit{o.nope}']) {|f| + f.read + } + status = $? + assert_match(/undefined method `nope'/, out, bug8501) + assert_not_predicate(status, :success?, bug8501) end def test_propagate_exit_code -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/