This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author giampaolo.rodola
Recipients giampaolo.rodola
Date 2013-11-30.15:53:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I recently implemented this in psutil and thought it would have been a nice addition for subprocess module as well:

Patch in attachment introduces a new subprocess.wait_procs() utility function which waits for multiple processes (Popen instances) to terminate.
The use case this covers is quote common: send SIGTERM to a list of processes, wait for them to terminate, send SIGKILL as last resort:

>>> def on_terminate(proc):
...     print("process {} terminated".format(proc))
>>> for p in procs:
...    p.terminate()
>>> gone, still_alive = wait_procs(procs, timeout=3, callback=on_terminate)
>>> for p in still_alive:
...     p.kill()

Are we still in time for Python 3.4?
Date User Action Args
2013-11-30 15:53:33giampaolo.rodolasetrecipients: + giampaolo.rodola
2013-11-30 15:53:33giampaolo.rodolasetmessageid: <>
2013-11-30 15:53:33giampaolo.rodolalinkissue19843 messages
2013-11-30 15:53:33giampaolo.rodolacreate