os.fork() different in cgi-script?
by Andreas Kuntzagk other posts by this author
Jul 2 2003 10:54AM messages near this date
Re: how to pass a file descriptor in a swig module
|
Re: os.fork() different in cgi-script?
Hi,
following code:
#!/usr/bin/python
import os
import sys
def main():
print "Content-Type: text/plain\n\n"
print os.getpid()
childPID = os.fork()
if childPID == 0:
sys.exit()
else:
os.wait()
if __name__ == "__main__":
main()
when run on a shell, gives the result:
---------------------------
Content-Type: text/plain
20953
----------------------------
but run as a cgi-script it gives:
---------------------------
21039
Content-Type: text/plain
21039
---------------------------
So it looks the main() is run 2 times.
Is it so? And if yes, why?
I googled for this but only found a similar question from 1997 and no
answer.
Ciao, Andreas
--
http://mail.python.org/mailman/listinfo/python-list
Thread:
Andreas Kuntzagk
Juha Autero
Andreas Kuntzagk
Andreas Kuntzagk
Michael Coleman
Andreas Kuntzagk
Michael Coleman
|