aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index e5c8d47fe2..d85fe85ccf 100644
--- a/eval.c
+++ b/eval.c
@@ -164,7 +164,13 @@ ruby_cleanup(int ex)
errs[1] = th->errinfo;
th->safe_level = 0;
Init_stack((void *)&state);
- ruby_finalize_0();
+
+ PUSH_TAG();
+ if ((state = EXEC_TAG()) == 0) {
+ SAVE_ROOT_JMPBUF(th, ruby_finalize_0());
+ }
+ POP_TAG();
+
errs[0] = th->errinfo;
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {