in reply to LWP Forking
The reason system doesn't work is that it waits for the child process to return. The solution is to use fork and then exec. When running under a web server, you must close STDERR and STDOUT, or the browser won't know that the CGI script has finished.
if ($pid = fork()) { # parent } else { die "Cannot fork:$!" unless defined $pid; close(STDOUT); close(STDERR); exec("otherscript.pl"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: LWP Forking
by Mitch (Sexton) on Apr 21, 2003 at 21:19 UTC | |
by bbfu (Curate) on Apr 21, 2003 at 23:39 UTC |