kill 0, $pid while sleep 1 and $timeout--; kill 3, $pid and return if $timeout; #### $pid = open my $fh, "$cmd |" or die "$!, $^E";