i want python job start process , exit, while keeping child running.
when start subprocess using
popen([sys.executable,"foo","bar"]) (as recommended instead of spawn), child dies when parent exits (the above popen last thing parent does).
this, of course, can remedied using nohup:
with open("/dev/null","w") fd: popen(["nohup",sys.executable,"foo","bar"],stdout=fd) (i have redirect output /dev/null prevent nohup creating file nohup.out , announcing misdeed on stdout).
is there more elegant/pythonic way deal this?
i tried os.fork + signal.signal(signal.sighup,signal.sig_ign) , child still died when parent exited.
Comments
Post a Comment