Killing a script launched in a Process via os.system()

前端 未结 4 683
旧时难觅i
旧时难觅i 2021-01-13 02:35

I have a python script which launches several processes. Each process basically just calls a shell script:

from multiprocessing import Process
import os
imp         


        
4条回答
  •  温柔的废话
    2021-01-13 03:26

    You should use an event to signal the worker to terminate, run the subprocess with subprocess module, then terminate it with Popen.terminate(). Calling Process.terminate() will not allow it worker to clean up. See the documentation for Process.terminate().

提交回复
热议问题