[issue5115] Extend subprocess.kill to be able to kill process groups

2019-06-30 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

this is part of a chain of other related issues.  the interesting thing in the 
patch in here is the potential feature to have send_signal/terminate/kill be 
able to optionally kill a process group.

the logic as is in the patch in this issue is dangerous as often the calling 
process _is_ the pgrp leader and would be killed.  we _never_ want the 
subprocess signaling methods to kill the current process as that would be 
surprising to users.

--
nosy: +gregory.p.smith
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2019-06-30 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> duplicate
superseder:  -> subprocess.run timeout does not function if shell=True and 
capture_output=True

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2019-06-30 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests:  -7893

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2019-06-27 Thread haizaar


Change by haizaar :


--
nosy: +haizaar

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2018-07-20 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +7893

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2018-02-16 Thread Fangyi Zhou

Change by Fangyi Zhou :


--
nosy: +fangyizhou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2017-04-24 Thread Eryk Sun

Eryk Sun added the comment:

Using a Windows job object should be paired with the creation flag 
CREATE_SUSPENDED. Callers may also need CREATE_BREAKAWAY_FROM_JOB, but setting 
that creation flag shouldn't be integrated into Popen.

The child has to be created suspended to ensure it doesn't spawn another 
process and exit before it's added to the job. Once it's in the job, call 
ResumeThread to start it. 

On Windows Vista and 7, the child may need to break away from Python's current 
job, if allowed. These older versions of Windows don't implement nested jobs, 
so adding the child to a job will fail if it's already in one. The job used by 
py.exe for python.exe isn't a problem in this case since it's configured for 
child processes to automatically break away, but python.exe may have been 
started directly and added to a job that's not configured for silent breakaway.

--
nosy: +eryksun
versions: +Python 3.7 -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2011-04-26 Thread Xuanji Li

Changes by Xuanji Li xua...@gmail.com:


--
nosy: +xuanji

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2011-04-26 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

Note that the setpgid creation part is now somewhat redundant with Popen's 
start_new_session flag (which calls setsid). Also, this should probably be an 
option, since with that patch every subprocess is in its own process group.

 I was wondering... what if process A runs a subprocess B which runs a
 subprocess C. Is C still considered a children of A and gets killed as
 well?

No.
When setpgid/setsid is called, a new group is created, so process C will be not 
be part of the same group as B.

--
nosy: +neologix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2011-04-18 Thread Ernst Sjöstrand

Changes by Ernst Sjöstrand ern...@gmail.com:


--
nosy: +Ernst.Sjöstrand

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2011-04-18 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
versions: +Python 3.3 -Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-06-17 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

A strong +1 on adding this feature.

I was wondering... what if process A runs a subprocess B which runs a 
subprocess C. Is C still considered a children of A and gets killed as well?

Does os.setpgid() takes care of such a thing? What about Windows instead?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-06-11 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

erickt: can you fix your patch?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-06-09 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-01-20 Thread Thomas Guettler

Changes by Thomas Guettler guet...@thomas-guettler.de:


--
nosy: +guettli

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 I suspect that on Windows, TerminateJobObject won't work 
 with a handle returned by CreateProcess.

TerminateJobObject works with CreateJobObject and AssignProcessToJobObject. The 
following code (from your patch) should call AssignProcessToJobObject (and 
CreateJobObject if there is no job yet):

+if not mswindows:
+os.setpgid(0, 0)

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-01-12 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
priority:  - normal
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2009-12-30 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
nosy: +brian.curtin

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2009-02-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@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 rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2009-01-31 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' billiej...@users.sourceforge.net:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2009-01-30 Thread Erick Tryzelaar

New submission from Erick Tryzelaar idade...@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 rep...@bugs.python.org
http://bugs.python.org/issue5115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com