Start background process/daemon from CGI script

后端 未结 10 1155
北恋
北恋 2020-12-10 02:02

I\'m trying to launch a background process from a CGI scripts. Basically, when a form is submitted the CGI script will indicate to the user that his or her request is being

10条回答
  •  粉色の甜心
    2020-12-10 02:59

    I haven't tried using fork but I have accomplished what you're asking by executing a sys.stdout.flush() after the original message, before calling the background process.

    i.e.

    print "Please wait..."
    sys.stdout.flush()
    
    output = some_processing() # put what you want to accomplish here
    print output               # in my case output was a redirect to a results page
    

提交回复
热议问题