|Perl Monk, Perl Meditation|
Fork() and exec()by axl163 (Scribe)
|on Oct 26, 2007 at 22:43 UTC||Need Help??|
axl163 has asked for the
wisdom of the Perl Monks concerning the following question:
I know it's Friday but I hope there is someone out there can help me with my situation. I have a cgi file that needs to execute another file without having the browser wait for the outcome of the execution. Here is a little diagram:
browser->request->cgi->execute another program | return submitted successful message and close connection without waiting for the other process
The code that I have is not working like the way I want because when I make the request to the cgi file, the browser waits for all processes to finish before closing the connection. I just need to execute "launch" and I do not need it to wait for it to finish before sending back the "successful submit" message. I think I am really close and this will probably involve forking and the use of exec() or even system() but this is what I have so far:
I have edited the code according to runrig's suggestion but I'm not sure if I did it right.
Any suggestions would be greatly appreciated. Thanks in advance.