# Timeout survival: a detached child in its own session outlives the # parent; the PID namespace must take it down with the run. import os import sys import time if os.fork() == 0: os.setsid() if os.fork() == 0: time.sleep(3600) os._exit(0) print("parent done") sys.stdout.flush()