* eval.c (ruby_cleanup): free current VM and its objspace even
when exiting by SystemExit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f6003894b9
commit
a2c4b890be
@ -1,3 +1,8 @@
|
|||||||
|
Sun Oct 31 22:24:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (ruby_cleanup): free current VM and its objspace even
|
||||||
|
when exiting by SystemExit.
|
||||||
|
|
||||||
Sun Oct 31 22:10:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Oct 31 22:10:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* compile.c (new_child_iseq): adjust argument types.
|
* compile.c (new_child_iseq): adjust argument types.
|
||||||
|
29
eval.c
29
eval.c
@ -162,6 +162,17 @@ ruby_cleanup(volatile int ex)
|
|||||||
POP_TAG();
|
POP_TAG();
|
||||||
rb_thread_stop_timer_thread();
|
rb_thread_stop_timer_thread();
|
||||||
|
|
||||||
|
#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
|
||||||
|
switch (ex) {
|
||||||
|
#if EXIT_SUCCESS != 0
|
||||||
|
case 0: ex = EXIT_SUCCESS; break;
|
||||||
|
#endif
|
||||||
|
#if EXIT_FAILURE != 1
|
||||||
|
case 1: ex = EXIT_FAILURE; break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
state = 0;
|
state = 0;
|
||||||
for (nerr = 0; nerr < numberof(errs); ++nerr) {
|
for (nerr = 0; nerr < numberof(errs); ++nerr) {
|
||||||
VALUE err = errs[nerr];
|
VALUE err = errs[nerr];
|
||||||
@ -172,31 +183,21 @@ ruby_cleanup(volatile int ex)
|
|||||||
if (TYPE(err) == T_NODE) continue;
|
if (TYPE(err) == T_NODE) continue;
|
||||||
|
|
||||||
if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
|
if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
|
||||||
return sysexit_status(err);
|
ex = sysexit_status(err);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (rb_obj_is_kind_of(err, rb_eSignal)) {
|
else if (rb_obj_is_kind_of(err, rb_eSignal)) {
|
||||||
VALUE sig = rb_iv_get(err, "signo");
|
VALUE sig = rb_iv_get(err, "signo");
|
||||||
state = NUM2INT(sig);
|
state = NUM2INT(sig);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (ex == 0) {
|
else if (ex == EXIT_SUCCESS) {
|
||||||
ex = 1;
|
ex = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ruby_vm_destruct(GET_VM());
|
ruby_vm_destruct(GET_VM());
|
||||||
if (state) ruby_default_signal(state);
|
if (state) ruby_default_signal(state);
|
||||||
|
|
||||||
#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
|
|
||||||
switch (ex) {
|
|
||||||
#if EXIT_SUCCESS != 0
|
|
||||||
case 0: return EXIT_SUCCESS;
|
|
||||||
#endif
|
|
||||||
#if EXIT_FAILURE != 1
|
|
||||||
case 1: return EXIT_FAILURE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ex;
|
return ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user