SmilingBuddha has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks:
I am executing a shell script (on unix) using pipe so to have access to STDOUT and STDERR in filehandle $jobfh:
This script may internally spawn many child processes. If I want to terminate all processes $jobfh->close does not work if the current process (launched by script.sh) is waiting for STDIN.$jobfh->open("script.sh 2>&1 |");
Thus, I need to kill the above process and all child (how do I create a list of all PIDs of script.sh?) processes of the above when I meet certain conditions in $jobfh. Can you please suggest how I can achieve killing the script (and all its child processes) when launching through open().
Thanks and best Regards.
SmilingBuddha
edit (broquaint): added formatting
Back to
Seekers of Perl Wisdom