diff options
-rw-r--r-- | t/op/fork.t | 10 | ||||
-rw-r--r-- | win32/perlhost.h | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/t/op/fork.t b/t/op/fork.t index 60c991b3e9..734e2234ff 100644 --- a/t/op/fork.t +++ b/t/op/fork.t @@ -519,3 +519,13 @@ sub main { } EXPECT foo +######## +# ${^GLOBAL_PHASE} at the end of a pseudo-fork +if (my $pid = fork) { + waitpid $pid, 0; +} else { + eval 'END { print "${^GLOBAL_PHASE}\n" }'; + exit; +} +EXPECT +END diff --git a/win32/perlhost.h b/win32/perlhost.h index 265328b69b..b1c6c805e5 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -1759,8 +1759,10 @@ restart: SvREFCNT_dec(PL_curstash); PL_curstash = (HV *)SvREFCNT_inc(PL_defstash); } - if (PL_endav && !PL_minus_c) + if (PL_endav && !PL_minus_c) { + PERL_SET_PHASE(PERL_PHASE_END); call_list(oldscope, PL_endav); + } status = STATUS_EXIT; break; case 3: |