Bdfy Bdfy - 11 months ago 51
Python Question

how to kill process and child processes from python?

for example from bash:

kill -9 -PID

os.kill(pid, signal.SIGKILL)
kill only parent process.


When you pass a negative PID to kill, it actually sends the signal to the process group by that (absolute) number. You do the equivalent with os.killpg() in Python.