Navigation Menu

Skip to content

Commit

Permalink
call at_exit blocks within exception handlers
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@3293 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Jan 18, 2010
1 parent 91f4d14 commit d649cff
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion eval_jump.c
Expand Up @@ -40,6 +40,19 @@ rb_f_at_exit(VALUE self, SEL sel)
return proc;
}

static VALUE
rb_end_proc_call_try(VALUE proc)
{
return rb_proc_call2(proc, 0, NULL);
}

static VALUE
rb_end_proc_call_catch(VALUE data)
{
rb_vm_print_current_exception();
return Qnil;
}

void
rb_exec_end_proc(void)
{
Expand All @@ -48,7 +61,7 @@ rb_exec_end_proc(void)
if (count > 0) {
VALUE proc = RARRAY_AT(at_exit_procs, count - 1);
rb_ary_delete_at(at_exit_procs, count - 1);
rb_proc_call2(proc, 0, NULL);
rb_rescue(rb_end_proc_call_try, proc, rb_end_proc_call_catch, 0);
continue;
}
break;
Expand Down

0 comments on commit d649cff

Please sign in to comment.