Python Forum
how to clean up unstarted processes? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to clean up unstarted processes? (/thread-20718.html)



how to clean up unstarted processes? - Skaperen - Aug-27-2019

i have called subprocess.Popen() several times and collected the results. normally i would .start() these processes. suppose i encounter a situation that i need to not run these processes, but still do other things (not just exit). how do i go about cleaning this up to recover any resources used, both in this process and any processes that were created by this (but not other processes that might be in other lists, possibly already started)?


RE: how to clean up unstarted processes? - Larz60+ - Aug-27-2019

there are several bash commands that you can use to do this
https://www.servernoobs.com/how-to-find-and-kill-all-zombie-processes/
you should be able to run these using subprocess command from within python


RE: how to clean up unstarted processes? - Skaperen - Aug-27-2019

so when you create a process with child=subprocess.Popen() and don't child.start() it, it's a zombie? how do they get it into that state? and what does calling child.start() do to it?