I am using C to write a server(on Windows) that supports perl scripts.
Currently, I am using the function "fp=popen("perl script.cgi","rb")" to run the script and then send the result back to
to the browser. The problem of this scheme is the browser may time out if the script takes a long time to execute.
Therefore,I would like to make the server to fork the script aynchronously so that I can add a loop in the server to test
if the script finishes running or not,if it doesn't, then the server can send something back to the browser. Are there any
functions in C that can fork a new process aynchronously and test the status of a process?
I will appreciate any advises.
Implement your own popen() type functionality, and limit the amount of time the child can run, killing it if necessary.