The following script does not return tty
Isn't sys.exit(0)
enough from parent process?
Do I have to redirect stdin/stdout inside a child process to return tty? If so, how do i do that?
[Partial code]
pid = os.fork()
if pid > 0:
# parent
sys.exit(0)
#child
PID = os.getpid()
PID_DIR = '/var/pid/'
PID_FILE = '%s,%s.pid' % (machine_name, PID)
with PidFile(pidname=PID_FILE, piddir=PID_DIR):
worker_handler = gevent.spawn(worker)
master_handler = gevent.spawn(master)
handlers = [worker_handler, master_handler]
try:
while True:
time.sleep(1)
except Exception, msg:
print msg
gevent.killall(handlers)
handlers.joinall()