In Python 2.5, how do I kill a subprocess?

前端 未结 4 1077
灰色年华
灰色年华 2020-12-01 04:21

I am using the subprocess package in Python to run a subprocess, which I later need to kill. However, the documentation of the subprocess package states that the terminate()

4条回答
  •  忘掉有多难
    2020-12-01 05:05

    You call os.kill on the process pid.

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

    You're OK because you're on on Linux. Windows users are out of luck.

提交回复
热议问题