#!/usr/local/bin/perl -w
$SIG{INT} = sub {
warn "in parent";
exit;
};
for ( 0 .. 100) {
my $pid = fork;
unless (defined $pid) {
die "Error forking";
}
unless ($pid) {
exec ("./test2.pl");
}
else {
wait;
}
}
####
# test2.pl
#!/usr/local/bin/perl
$SIG{INT} = sub { warn "in child\n"; exit; };
sleep 100;
####
in parent at ./test.pl line 4.
in child
> <--- shell prompt.