Mailing List Archive

[issue5115] Extend subprocess.kill to be able to kill process groups
New submission from Erick Tryzelaar <idadesub@users.sourceforge.net>:

It would be really handy to add a way to portably kill process groups of
a process spawned with subprocess.Popen. My project starts a process,
which then starts other long running processes. Because of this process
tree, there's no way for me to portably kill all of those processes.
Would it be possible to extend subprocess with these features? I did
find someone who's already implemented this [1], and it's working well
in my project. There was some discussion about adding this, but it seems
no one actually committed a patch to implement it.

Anyway, I've attached a patch against python3.0's svn branch that
implements this. I don't have access to windows, so I'm not able to make
sure that the TerminateJobObject is correct, and works.

[1]: http://benjamin.smedbergs.us/blog/2006-12-11/killableprocesspy/
[2]: http://mail.python.org/pipermail/python-list/2008-April/487588.html

----------
components: Library (Lib)
files: killpg.patch
keywords: patch
messages: 80850
nosy: erickt
severity: normal
status: open
title: Extend subprocess.kill to be able to kill process groups
type: feature request
versions: Python 3.0
Added file: http://bugs.python.org/file12899/killpg.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5115>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5115] Extend subprocess.kill to be able to kill process groups [ In reply to ]
Changes by Giampaolo Rodola' <billiejoex@users.sourceforge.net>:


----------
nosy: +giampaolo.rodola

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5115>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5115] Extend subprocess.kill to be able to kill process groups [ In reply to ]
Amaury Forgeot d'Arc <amauryfa@gmail.com> added the comment:

I suspect that on Windows, TerminateJobObject won't work with a handle
returned by CreateProcess.
A solution could look like
http://www.mobzystems.com/code/killprocesstree.aspx

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5115>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com