http://www.perlmonks.org?node_id=232118

submersible_toaster has asked for the wisdom of the Perl Monks concerning the following question:

Mellow Funks (sic)

Recently I have been writing perl wrappers around various windows executables, being launched by smedge2 . Being sensible and considerate, (covering my ass) I inserted signal handlers in the wrappers, which call a cleanup sub, whose goal is to kill the PID returned by a piped open. Hence the wrapper cleans up it's own mess. Great! except for the non-POSIX ness of windows. Smedge seems pretty wise to 'processes that refuse to die' and it's method of killing the wrapper does not send any signals that I can catch AFAIK. The by product of course is that the wrapper goes down and it's children go rogue - no caring that nothing is listening to the output pipe.

Win32::Process looks great for managing process, but not for determining whether THIS process is being killed by some OTHER process.


How can I trap this not-a-SIGnal so my wrappers can cleanup correctly?

I can't believe it's not psellchecked