Ensuring subprocesses are dead on exiting Python program

后端 未结 14 1717
有刺的猬
有刺的猬 2020-12-02 09:17

Is there a way to ensure all created subprocess are dead at exit time of a Python program? By subprocess I mean those created with subprocess.Popen().

If not, should

14条回答
  •  天命终不由人
    2020-12-02 09:46

    A solution for windows may be to use the win32 job api e.g. How do I automatically destroy child processes in Windows?

    Here's an existing python implementation

    https://gist.github.com/ubershmekel/119697afba2eaecc6330

提交回复
热议问题