classification
Title: subprocess: more general (non-buffering) communication
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: astrand Nosy List: astrand, georg.brandl, ianbicking, josiahcarlson
Priority: normal Keywords: patch

Created on 2005-08-15 19:15 by ianbicking, last changed 2010-08-21 12:51 by BreamoreBoy.

Files
File name Uploaded Description Edit
subprocess_communicate_alternative.py ianbicking, 2005-08-15 19:15
Messages (4)
msg54590 - (view) Author: Ian Bicking (ianbicking) * Date: 2005-08-15 19:15
Right now you can use subprocess.Popen.communicate() to
make communication with subprocesses much easier and
less likely to block than communicating directly with
.stdin, .stdout, etc.  However, that requires
completely buffering the input and output.

The functionality of communicate() (which is somewhat
complex because of platform issues) could be made more
general fairly easily.  The current functionality of
communicate could then be implemented in terms of that
new method.

I attached a function I'm using which does that for the
posix systems (basically turning Popen's posix
communicate into a function with some modifications). 
Replace "proc" with "self" (and give the function a
better name) and you'd have a method.

If patch 1175984 was accepted, then this wouldn't be
that much of an issue:
http://sourceforge.net/tracker/index.php?func=detail&aid=1175984&group_id=5470&atid=305470

msg54591 - (view) Author: Josiah Carlson (josiahcarlson) Date: 2005-08-22 19:02
Logged In: YES 
user_id=341410

Would an asynchronous subprocess (which you would poll
manually) be better/sufficient?

http://python.org/sf/1191964
msg54592 - (view) Author: Josiah Carlson (josiahcarlson) Date: 2005-08-22 19:03
Logged In: YES 
user_id=341410

Also, what you post is not a 'bug', it is a 'feature request'.
msg54593 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-08-22 19:38
Logged In: YES 
user_id=1188172

Reclassifying as RFE. Assigning to Peter.
History
Date User Action Args
2010-08-21 12:51:31BreamoreBoysetversions: - Python 2.7
2009-05-12 17:48:05ajaksu2setkeywords: + patch
stage: test needed
versions: + Python 2.7, Python 3.2, - Python 2.6
2009-02-15 22:15:42ajaksu2linkissue1175984 dependencies
2008-01-05 19:32:38christian.heimessetversions: + Python 2.6
2005-08-15 19:15:12ianbickingcreate