in reply to Doing a system command and getting the pid
It'd be nice if you gave us what you had tried. It really does help. Anyway ... Off the top of my head, untested:
Update: Fixed the off-by-everything error as noted by Eimi Metamorphoumai - thanks!FORK: { if (my $child = fork()) { print "Child process ID: $child\n"; } elsif (not defined $child) { # failed to fork. next FORK; } else { # child. open(STDOUT, '>somefile); close(STDIN); # just good practice for background procs exec($program, @program_args); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Doing a system command and getting the pid
by Eimi Metamorphoumai (Deacon) on Jan 21, 2005 at 00:41 UTC |