Open willir opened 2 years ago
Hi, thanks for the great library. I have a question - is it possible to set PR_SET_PDEATHSIG on Linux for all running commands?
PR_SET_PDEATHSIG
When I use subprocess myself, I do it like:
SIGHUP = 1 PR_SET_PDEATHSIG = 1 libc = ctypes.CDLL("/lib64/libc.so.6") def set_pdeathsig_cb(): ppid = os.getpid() def cb(): res = libc.prctl(PR_SET_PDEATHSIG, SIGHUP) if res != 0: print(f"Fail to set PR_SET_PDEATHSIG. Return value: {res}", file=sys.stderr) sys.exit(1) if os.getppid() != ppid: print("Parent process has already died", file=sys.stderr) sys.exit(1) return cb with subprocess.Popen(cmd, preexec_fn=set_pdeathsig_cb()) as p: ...
Thank you.
Hi, thanks for the great library. I have a question - is it possible to set
PR_SET_PDEATHSIG
on Linux for all running commands?When I use subprocess myself, I do it like:
Thank you.