|Don't ask to ask, just ask|
killing pp exe on windows leaves child running?by sectokia (Sexton)
|on Aug 29, 2019 at 22:18 UTC||Need Help??|
sectokia has asked for the wisdom of the Perl Monks concerning the following question:
Hi wise monks!
I use pp on windows to create an exe.
When running that exe, pp seems to create a child process - which seems to be my perl program.
The problem I have is that if the 'parent' (pp?) is killed off, the child (my program) just keeps on running.
I tried to fix this in my program by getting the ppid, and then doing kill 0, $ppid, to detect if the parent is gone, but because of the way windows maintains the parent ppid in its process table (until all children are gone), kill 0 always returns true, even if the parent is terminated and gone.
I am using websocketd to calling my pp generated exe for each client, and websocketd kills the exe when clients disconnect. But this leaves my program running as a orphan child. Does anyone have any ideas to get around this?