in reply to Running a process in the background from CGI scripts...

Usually, if the parent forks and then exits, leaving the child to exec some external program, the browser should usually never see the output of the child process, because the exiting of the parent signals the end of the request as far as the web server is concerned.

The exception to this is Windows, where fork is emulated. In this case, the parent's call to exit will not cause the parent to exit until the child exits first, allowing the child's output to appear in the browser. At least that's my suspicion.

As another poster mentioned, the "fix" to this is just to keep the child from priting anything. Close STDOUT (and maybe STDERR) before exec'ing for instance.

  • Comment on Re: Running a process in the background from CGI scripts...