1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 34982: [Backport #5218]

* eval_jump.c (rb_exec_end_proc): remember the latest exit status.
	  [ruby-core:43173][Bug #5218]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@39378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2013-02-22 05:28:36 +00:00
parent bdcd3d62a8
commit 18488c1117
4 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Feb 22 14:28:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval_jump.c (rb_exec_end_proc): remember the latest exit status.
[ruby-core:43173][Bug #5218]
Fri Feb 22 14:25:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
* ext/readline/readline.c (Init_readline): don't set 0 to

View file

@ -99,6 +99,8 @@ rb_exec_end_proc(void)
struct end_proc_data *volatile link;
int status;
volatile int safe = rb_safe_level();
rb_thread_t *th = GET_THREAD();
VALUE errinfo = th->errinfo;
while (ephemeral_end_procs) {
link = ephemeral_end_procs;
@ -112,6 +114,7 @@ rb_exec_end_proc(void)
POP_TAG();
if (status) {
error_handle(status);
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
}
xfree(link);
}
@ -128,10 +131,12 @@ rb_exec_end_proc(void)
POP_TAG();
if (status) {
error_handle(status);
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
}
xfree(link);
}
rb_set_safe_level_force(safe);
th->errinfo = errinfo;
}
void

View file

@ -145,4 +145,17 @@ EOW
assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
t.close
end
def test_rescue_at_exit
bug5218 = '[ruby-core:43173][Bug #5218]'
cmd = [
"raise 'X' rescue nil",
"nil",
"exit(42)",
]
%w[at_exit END].each do |ex|
out, err, status = EnvUtil.invoke_ruby(cmd.map {|s|["-e", "#{ex} {#{s}}"]}.flatten, "", true, true)
assert_equal(["", "", 42], [out, err, status.exitstatus], "#{bug5218}: #{ex}")
end
end
end

View file

@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
#define RUBY_PATCHLEVEL 387
#define RUBY_PATCHLEVEL 388
#define RUBY_RELEASE_DATE "2013-02-22"
#define RUBY_RELEASE_YEAR 2013