Re: killing a forked process

2009-04-13 Thread Chas. Owens
On Mon, Apr 13, 2009 at 04:49, Michael Alipio wrote: snip > my $pid = fork (); You must check to see if $pid is defined. If it isn't then fork failed. The parentheses are oddly placed and unnecessary. > if ($pid == 0){ >  exec ("top"); Again with the odd parentheses placement. Function calls

Re: killing a forked process (external programs always detach from child process)

2009-04-13 Thread Michael Alipio
Hi, I'm trying to launch and external program using fork. my $pid = fork() if ($pid == 0){ system ("top"); exit (0); }else{ waitpid ($pid, 0) } print "External Program died!"; The problem is "top", or the program i'm actually going to run always detaches to the child perl process I have