Dear Monks
After fork()'ing, I am unable to catch a CHLD signal in the parent. In my example, the child process does nothing and calls die(). The parent would like to know that the CHLD process has terminated.
use strict; use warnings; use 5.010; my $pid = fork; if (!defined $pid) { die "Couldn't fork: $!"; } if ($pid) { #then in parent local $SIG{CHLD} = sub {say 'caught it';}; say 'hello world'; } else { #then in child die; } --output:-- hello world
My expected output:
caught it hello world #or hello world caught it
In reply to why can't I catch CHLD signal? by 7stud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |