in reply to Cannot kill child process when it's waiting for response
Depending on what the child is actually supposed to be doing, there may be some traps here. Definitely read "perldoc -f open" and "perldoc perlipc".my $child_pid = open( CHILD, "| child_program arg1 arg2" ) || die "unable to start child_program\n"; # Feed the child, if that's necessary select CHILD; $|++; # turn off output buffering print CHILD $/; # send a blank line # give the child about 5 seconds to produce something my $counter = 0; until ( -s "child_output.file" or ++$counter == 5 ) { sleep 1; } # now, we could kill $child_pid, or just: close CHILD;
|
|---|