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:
parent
bdcd3d62a8
commit
18488c1117
4 changed files with 24 additions and 1 deletions
|
|
@ -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>
|
Fri Feb 22 14:25:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* ext/readline/readline.c (Init_readline): don't set 0 to
|
* ext/readline/readline.c (Init_readline): don't set 0 to
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -145,4 +145,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
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#define RUBY_VERSION "1.9.3"
|
#define RUBY_VERSION "1.9.3"
|
||||||
#define RUBY_PATCHLEVEL 387
|
#define RUBY_PATCHLEVEL 388
|
||||||
|
|
||||||
#define RUBY_RELEASE_DATE "2013-02-22"
|
#define RUBY_RELEASE_DATE "2013-02-22"
|
||||||
#define RUBY_RELEASE_YEAR 2013
|
#define RUBY_RELEASE_YEAR 2013
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue