#define PL_eval_root (PERL_GET_INTERP->Ieval_root)
#define PL_eval_start (PERL_GET_INTERP->Ieval_start)
#define PL_evalseq (PERL_GET_INTERP->Ievalseq)
+#define PL_exit_flags (PERL_GET_INTERP->Iexit_flags)
#define PL_exitlist (PERL_GET_INTERP->Iexitlist)
#define PL_exitlistlen (PERL_GET_INTERP->Iexitlistlen)
#define PL_expect (PERL_GET_INTERP->Iexpect)
#define PL_eval_root (vTHX->Ieval_root)
#define PL_eval_start (vTHX->Ieval_start)
#define PL_evalseq (vTHX->Ievalseq)
+#define PL_exit_flags (vTHX->Iexit_flags)
#define PL_exitlist (vTHX->Iexitlist)
#define PL_exitlistlen (vTHX->Iexitlistlen)
#define PL_expect (vTHX->Iexpect)
#define PL_eval_root (aTHXo->interp.Ieval_root)
#define PL_eval_start (aTHXo->interp.Ieval_start)
#define PL_evalseq (aTHXo->interp.Ievalseq)
+#define PL_exit_flags (aTHXo->interp.Iexit_flags)
#define PL_exitlist (aTHXo->interp.Iexitlist)
#define PL_exitlistlen (aTHXo->interp.Iexitlistlen)
#define PL_expect (aTHXo->interp.Iexpect)
#define PL_Ieval_root PL_eval_root
#define PL_Ieval_start PL_eval_start
#define PL_Ievalseq PL_evalseq
+#define PL_Iexit_flags PL_exit_flags
#define PL_Iexitlist PL_exitlist
#define PL_Iexitlistlen PL_exitlistlen
#define PL_Iexpect PL_expect
/* top fd to pass to subprocesses */
PERLVAR(Imultiline, int) /* $*--do strings hold >1 line? */
PERLVAR(Istatusvalue, I32) /* $? */
+PERLVAR(Iexit_flags, U8) /* was exit() unexpected, etc. */
#ifdef VMS
PERLVAR(Istatusvalue_vms,U32)
#endif
#define PL_eval_start (*Perl_Ieval_start_ptr(aTHXo))
#undef PL_evalseq
#define PL_evalseq (*Perl_Ievalseq_ptr(aTHXo))
+#undef PL_exit_flags
+#define PL_exit_flags (*Perl_Iexit_flags_ptr(aTHXo))
#undef PL_exitlist
#define PL_exitlist (*Perl_Iexitlist_ptr(aTHXo))
#undef PL_exitlistlen
/* my_exit() was called */
PL_curstash = PL_defstash;
FREETMPS;
- if (PL_statusvalue)
+ if (PL_statusvalue && !(PL_exit_flags & PERL_EXIT_EXPECTED))
Perl_croak(aTHX_ "Callback called exit");
my_exit_jump();
/* NOTREACHED */
/* my_exit() was called */
PL_curstash = PL_defstash;
FREETMPS;
- if (PL_statusvalue)
+ if (PL_statusvalue && !(PL_exit_flags & PERL_EXIT_EXPECTED))
Perl_croak(aTHX_ "Callback called exit");
my_exit_jump();
/* NOTREACHED */
PL_curstash = PL_defstash;
PL_curcop = &PL_compiling;
CopLINE_set(PL_curcop, oldline);
- if (PL_statusvalue) {
+ if (PL_statusvalue && !(PL_exit_flags & PERL_EXIT_EXPECTED)) {
if (paramList == PL_beginav)
Perl_croak(aTHX_ "BEGIN failed--compilation aborted");
else
# define STATUS_ALL_FAILURE (PL_statusvalue = 1)
#endif
+/* flags in PL_exit_flags for nature of exit() */
+#define PERL_EXIT_EXPECTED 0x01
+
#ifndef MEMBER_TO_FPTR
#define MEMBER_TO_FPTR(name) name
#endif
anum = 0;
#endif
}
+ PL_exit_flags |= PERL_EXIT_EXPECTED;
my_exit(anum);
PUSHs(&PL_sv_undef);
RETURN;