Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle exit() within END blocks better
  • Loading branch information
lizmat committed Oct 29, 2014
1 parent 2ca414c commit b6b1b7c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/control.pm
Expand Up @@ -213,9 +213,14 @@ multi sub EVAL(Cool $code, :$lang = 'perl6', PseudoStash :$context) {
}

sub exit($status = 0) {
state $exit;
$exit = $status;

return if $++; # already exiting

THE_END();
nqp::exit(nqp::unbox_i($status.Int));
$status;
nqp::exit(nqp::unbox_i($exit.Int));
$exit;
}

sub THE_END {
Expand Down

0 comments on commit b6b1b7c

Please sign in to comment.