Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

How to kill chain of parent processes in python?

$
0
0

So I have a script which creates a child process with the Subprocess module.This child process then also creates child processes and it can go on for a while. Is there any way to kill the entire chain of parent processes from a child process without knowing how deep in the chain it is?

i tried:

os.kill(os.getppid(), signal.SIGTERM)

but that only kills the direct parent of the child process. Id like to go all the way to the top of the chain and kill the processes coming down.


Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>