Answers for "python fork error"

0

python fork error

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"
Posted by: Guest on August-04-2021
0

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"
Posted by: Guest on August-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language