python fork error
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"
3.33
3
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"
Thank you!
3
0
Are there any code examples left?
New code examples in category Python