summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-10 06:35:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-10 06:35:37 +0000
commitb82ded24cc856435a87b289890c8954d96ecea66 (patch)
tree6cb046ca888b0322f07195db98787c280e8fe9da
parent222d028808b839f911db718d34ff8c133a57c8ea (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--eval_error.c1
-rw-r--r--test/ruby/test_beginendblock.rb14
3 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b8925a34ab..5f2fb117b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-Mon Jun 10 15:34:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 15:35:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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.
diff --git a/eval_error.c b/eval_error.c
index bd691fcbad..fad8c228f6 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -197,6 +197,7 @@ error_print(void)
}
error:
TH_POP_TAG();
+ th->errinfo = errinfo;
rb_thread_raised_set(th, raised_flag);
}
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index 7a9eb23bfa..e7901bce5e 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -85,8 +85,22 @@ EOW
'-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