in reply to Child process lingers after keyboard interrupt on Windows
I found that fork + exec is the way perl spawns a sub-process, including on Windows. With this the keyboard interrupt will be sent to the subprocess as expected:
I suppose I still have to disable $SIG{'INT'} while waiting for the subprocess (that is, before the waitpid call), like system() does, but somehow I still want to receive the interrupt after the child process exits.my $child = fork(); if ($child) { say 'Waiting'; waitpid $child, 0; say 'Exiting' } else { exec 'cmd', '/C', 'PowerShell', '-Command', 'sleep', '7', '&', 'Echo', 'Done' }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Child process lingers after keyboard interrupt on Windows
by afoken (Chancellor) on Nov 01, 2018 at 22:44 UTC |