📅  最后修改于: 2022-03-11 14:45:06.886000             🧑  作者: Mango
import os
def _fork():
raise OSError()
os.fork = _fork
for i in range(1,4):
try:
pid = os.fork()
except OSError:
print ("Error forking process")
continue
if pid == 0:
print "In child process"
os._exit(0)
print "In parent process"