in reply to Getting the pid of the process launched by my perl program

$SIG{CHLD} = 'IGNORE'; # on systems where it's supported defined( my $pid = fork ) or die "fork: $!"; if ( $pid ) { # parent print "child pid is $pid\n"; } else { # child exec("a.out") or die "exec: $!"; }
--
edan

Replies are listed 'Best First'.
Re^2: Getting the pid of the process launched by my perl program
by Anonymous Monk on Dec 22, 2004 at 11:05 UTC
    Thanx much edan and ozone !!
Re^2: Getting the pid of the process launched by my perl program
by Anonymous Monk on Apr 12, 2010 at 11:20 UTC
    I'm using the same logic to monitor the child process with a timer in the parent. On maximum timeout I'm killing the child process. The issue is I'm running an exe from the child which doesn't die on kill the child. I tried to explicitly kill the process with taskkill on windows and it works fine. But I face portability issues because of using taskkill. Can anybody help on this?