# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #122355]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122355 >


<hoelzro> in Perl 5, one can assign to $? in an END block to alter a
program's exit status.  Is there an analogous construct in Perl 6?
<masak> hoelzro: `exit($status);`
<masak> hm, `END exit(5)` hangs locally.
<hoelzro> masak: that's what I tried, and also discovered =)
<masak> r: END exit(5)
<camelia> rakudo-{parrot,moar} e56d94: OUTPUT«(timeout)»
<camelia> ..rakudo-jvm e56d94: OUTPUT«(timeout)Unhandled exception:
java.lang.StackOverflowError [...]
* masak submits rakudobug

Moar and Parrot loop forever; the JVM blows the call stack. My guess
is that a call to &exit tries to run all the registered END blocks or
something.

I don't recall the spec mentioning this, but it feels fairly obvious
to me that we should support calling &exit from an END block, and that
it should Just Work. We probably should have wording in S32 to that
effect.

Reply via email to