diff options
author | David Mitchell <davem@iabyn.com> | 2018-05-28 15:54:57 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-05-28 15:59:49 +0100 |
commit | 9f9606382c45ba5e9600dddf96abfe956762af99 (patch) | |
tree | 11499b0a727f3750eff77e46bef6c69b5fbf0c34 | |
parent | 755a646bad948230ce023df23ba641e85557e0f2 (diff) | |
download | perl-9f9606382c45ba5e9600dddf96abfe956762af99.tar.gz |
revert perl_run() 0 -> 256 return mapping
RT #133220
This commit partially reverts v5.27.6-180-g0301e89953.
That commit changed the return values of perl_parse() and perl_run()
so that an exit(0) wouldn't return 0 (which indicates a normal finish)
and instead return 0x100, which a indicates non-normal return, but with
a value which if used as an 8-bit process exit value on UNIX, has the
modulo value of 0.
However, it turns out that perl_run() (via S_run_body()) does a my_exit(0)
rather than just running to completion. So it turns out that it's not
possible to distinguish between perl code finishing normally, and perl
code doing exit(0).
This broke code which embedded perl and expected perl_run() to return 0
on normal completion.
It may be possible to fix this by getting S_run_body() to not call
my_exit(0), but that's too unpredictable change while we're at -RC1.
So just revert the new perl_run() 0x100 behaviour for now.
-rw-r--r-- | perl.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -2594,7 +2594,7 @@ int perl_run(pTHXx) { I32 oldscope; - int ret = 0, exit_called = 0; + int ret = 0; dJMPENV; PERL_ARGS_ASSERT_PERL_RUN; @@ -2615,10 +2615,8 @@ perl_run(pTHXx) case 0: /* normal completion */ redo_body: run_body(oldscope); - goto handle_exit; + /* FALLTHROUGH */ case 2: /* my_exit() */ - exit_called = 1; - handle_exit: while (PL_scopestack_ix > oldscope) LEAVE; FREETMPS; @@ -2632,12 +2630,7 @@ perl_run(pTHXx) if (PerlEnv_getenv("PERL_DEBUG_MSTATS")) dump_mstats("after execution: "); #endif - if (exit_called) { - ret = STATUS_EXIT; - if (ret == 0) ret = 0x100; - } else { - ret = 0; - } + ret = STATUS_EXIT; break; case 3: if (PL_restartop) { |