diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-31 13:24:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-31 13:24:19 +0000 |
commit | a2c4b890be2004660db6e595040a8918423984a7 (patch) | |
tree | ab99d3dc25363b9efa91e53cd7dfd301cf851b83 /eval.c | |
parent | f6003894b91987f309cfd0164561db86d5eaa82c (diff) | |
download | ruby-a2c4b890be2004660db6e595040a8918423984a7.tar.gz |
* 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
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -162,6 +162,17 @@ ruby_cleanup(volatile int ex) POP_TAG(); 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; for (nerr = 0; nerr < numberof(errs); ++nerr) { VALUE err = errs[nerr]; @@ -172,31 +183,21 @@ ruby_cleanup(volatile int ex) if (TYPE(err) == T_NODE) continue; 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)) { VALUE sig = rb_iv_get(err, "signo"); state = NUM2INT(sig); break; } - else if (ex == 0) { - ex = 1; + else if (ex == EXIT_SUCCESS) { + ex = EXIT_FAILURE; } } ruby_vm_destruct(GET_VM()); 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; } |