[Python-Dev] suggest: nowait option in subprocess.communicate

Josiah Carlson jcarlson at uci.edu
Wed Apr 5 21:39:15 CEST 2006


Neal Becker <ndbecker2 at gmail.com> wrote:
> 
> I'd like to start several processes, each a pipe reading from my python main
> process.  It looks like I want to write all my data to each process, then
> use communicate(), but I don't want to wait for each process yet, since
> then they would block each other.  Why not add a nowait option to
> communicate?

Alternatively, someone could commit some rough equivalent of this to the
subprocess module:
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

Yes, I wrote it, and previously suggested it within the previous thread
"Add timeout to subprocess.py?". Guido had previously privately asked if
it could be phased as a patch to subprocess.py in such a way to be 2.2
compatible.

Aside from fcntl module semantics (I don't know if they changed, whether
it should be using FCNTL instead, ...), and/or the 3 additional
functions from pywin32 that probably should be included in the
_subprocess module on Windows, the core functionality of a pollable
subprocess is available in the above recipe.

 - Josiah



More information about the Python-Dev mailing list