I have a perl script with multiple child processes generated with fork. The parent handles SIGINT and child processes ignore SIGINT ($SIG{INT} = 'IGNORE').
$SIG{'INT'} = sub {
print "Caught Ctrl+C by $$\n";
# while($result != -1){
# $result = wait();
#}
die "Stopping...";
};
a) If include the commented lines the script waits for the children to complete and then exits.
b) But if I comment the "wait" lines I assume it works like this - the script exits and the parent process is terminated - the children continue running in the background and display some message as expected before exiting.
I understand the a) case but how does the b) case work, please explain why doesn't this generate zombie processes ?
This question extends/is related to Wait for children to complete if parent intercepts SIGINT