Why not use the fact that a pipe-open returns the PID of the child on success?
my $child = open my $y, '/usr/bin/sleep 5|' or die "Couldn't spawn: $!/$?"; END { kill 9, $child if $child; };
In reply to Re: open pipe for input and die
by Corion
in thread open pipe for input and die
by pht
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |