in reply to How to see the processId of the process called by system command from perl
Note that depending on how you call exec, $pid will either be the pid of the R command or the pid of a shell that perl creates to invoke the R command. Examples:my $pid; defined($pid = fork()) or die "unable to fork: $!\n"; if ($pid == 0) { # child exec(...); # exec R script here die "unable to exec: $!\n"; } # parent continues here
exec("R", "and", "some", "args"); # $pid will be the R command exec("R and some args > out"); # $pid will be that of a shell
|
|---|