how to kill (or avoid) zombie processes with subprocess module

后端 未结 9 1196
悲&欢浪女
悲&欢浪女 2020-11-29 22:10

When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess \"completes\". I am unable to

9条回答
  •  执笔经年
    2020-11-29 22:33

    I'm not entirely sure what you mean by no_wait(). Do you mean you can't block waiting for child processes to finish? Assuming so, I think this will do what you want:

    os.wait3(os.WNOHANG)
    

提交回复
热议问题