Bdfy Bdfy - 5 months ago 14x
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.