How to kill a child process

fork, python

Solution

You should pass signals like `signal.SIGKILL` (9), `signal.SIGTERM` (15) to kill the process.

import signal

...

os.kill(logProc, signal.SIGKILL)

According to Linux `kill(2)`:

If `sig` is `0`, then no signal is sent, but error checking is still performed; this can be used to check for the existence of a process ID orprocess group ID.

Problem

I've found several methods to kill a child process. I would like to use the os.kill(pid). But it doesn't work, I guess it should though. ``` def onExit(): os.kill(logProc, 0) QtCore.QCoreApplication.instance().quit return button.clicked.connect(onExit) logProc=os.fork() if logProc>0: proc() ```

Original source