(talking unix/linux) If you want to be able to control a child process, you need it's PID. You get it either with fork:
or open:my $pid; if (($pid = fork()) == 0) { # child process exec 'some/program','and', 'args'; } else { # parent process $SIG{'CHLD'} = \&sub_that_handles_child_exit_notify; } # dosomething with $pid... my $is_alive = kill 0, $pid; # see if still alive kill 15, $pid; # send a SIGTERM
my $pid = open(FH,"process @args |"); # to read from it my $pid = open(FH,"| process @args"); # to write to it
For handling input and output, see IPC::Open2. For handling STDERR as well, IPC::Open3. To set timeouts, see alarm.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: process handling
by shmem
in thread process handling
by domcyrus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |