in reply to killing pp exe on windows leaves child running?
Hi
Report this to rt://PAR for PAR::FAQ
TODO/BUG rt://PAR/PAR::FAQ is also missing a copy/mention of ppsimple.pl and ppautolink.pl
BEGIN { my $PAR_PROGNAME = $ENV{PAR_PROGNAME}; use Win32::Process::Info(); my $pi = Win32::Process::Info->new(); my $parentpid = $pi->GetProcInfo( $$, { no_user_info => 1 } )->[0]->{ParentProce +ssId}; my $ExecutablePath = $pi->GetProcInfo( $parentpid, { no_user_info => 1 } )->[0] ->{ExecutablePath}; undef $pi; no Win32::Process::Info; sub IsParParentAlive { ## IsWin32ParParentAlive $PAR_PROGNAME eq $ExecutablePath ## doublecheck ## $ENV{PAR_SPAWNED} ## equivalent statement and kill 0, $parentpid; } } ## end BEGIN
Usage, if parent a.exe got killed, then PAR_SPAWNED a.exe dies hard
while( 1 ){ print " $$ doing stuff\n"; sleep 1; if( not IsParParentAlive() ){ die "ParParent is dead"; } }
https://metacpan.org/source/RSCHUPP/PAR-Packer-1.049/contrib/docs/who_am_i.txt
https://metacpan.org/source/RSCHUPP/PAR-Packer-1.049/contrib/docs/where_is_it.txt
https://perldoc.perl.org/perlport.html#kill
https://metacpan.org/pod/PAR::Environment#PAR_PROGNAME
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: killing pp exe on windows leaves child running? ( IsParParentAlive P9Y::ProcessTable )
by Anonymous Monk on Sep 01, 2019 at 04:23 UTC |