* 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/trunk@34982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
90b7ddb89f
commit
b19f3a8a15
@ -1,3 +1,8 @@
|
|||||||
|
Mon Mar 12 10:13:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval_jump.c (rb_exec_end_proc): remember the latest exit status.
|
||||||
|
[ruby-core:43173][Bug #5218]
|
||||||
|
|
||||||
Mon Mar 12 07:33:12 2012 Tanaka Akira <akr@fsij.org>
|
Mon Mar 12 07:33:12 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* lib/tmpdir.rb: update document for changing
|
* lib/tmpdir.rb: update document for changing
|
||||||
|
@ -99,6 +99,8 @@ rb_exec_end_proc(void)
|
|||||||
struct end_proc_data *volatile link;
|
struct end_proc_data *volatile link;
|
||||||
int status;
|
int status;
|
||||||
volatile int safe = rb_safe_level();
|
volatile int safe = rb_safe_level();
|
||||||
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
VALUE errinfo = th->errinfo;
|
||||||
|
|
||||||
while (ephemeral_end_procs) {
|
while (ephemeral_end_procs) {
|
||||||
link = ephemeral_end_procs;
|
link = ephemeral_end_procs;
|
||||||
@ -112,6 +114,7 @@ rb_exec_end_proc(void)
|
|||||||
POP_TAG();
|
POP_TAG();
|
||||||
if (status) {
|
if (status) {
|
||||||
error_handle(status);
|
error_handle(status);
|
||||||
|
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
|
||||||
}
|
}
|
||||||
xfree(link);
|
xfree(link);
|
||||||
}
|
}
|
||||||
@ -128,10 +131,12 @@ rb_exec_end_proc(void)
|
|||||||
POP_TAG();
|
POP_TAG();
|
||||||
if (status) {
|
if (status) {
|
||||||
error_handle(status);
|
error_handle(status);
|
||||||
|
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
|
||||||
}
|
}
|
||||||
xfree(link);
|
xfree(link);
|
||||||
}
|
}
|
||||||
rb_set_safe_level_force(safe);
|
rb_set_safe_level_force(safe);
|
||||||
|
th->errinfo = errinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -148,4 +148,17 @@ EOW
|
|||||||
assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
|
assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
|
||||||
t.close
|
t.close
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user