Comment 6 for bug 625551

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: [Bug 625551] Re: selftest --parallel=subprocess ignores child stderr pipes

Robert Collins wrote:
> On Fri, May 27, 2011 at 7:06 PM, Andrew Bennetts
> <email address hidden> wrote:
> > Robert Collins wrote:
> >> Or you could improve subunit!
> >
> > Unfortunately the only easy way to improve the situation would involve
> > adding threads to subunit, and I'm not sure I hate myself enough to be
> > able to write that code :P
>
> Why? the parser and the get-data functions are already separated -
> subunit was written with twisted use in mind.

Because subprocess doesn't expose a way to read incrementally from both
stdout and stderr. The best you can do with it is use .communicate()
to feed a canned stdin and get back a fully read stdout and stderr once
the process exits.

So if you want to drain stdout and stderr simultaneously (and we do) you
either need to reimplement that part of subprocess (the easiest way to
do that portably is with threads) or use something else entirely, like
Twisted, which would be pretty invasive for bzr selftest.

In short: I don't see a nice way to implement a get-data function that
incidentally drains stderr with the tools the stdlib provides, except
threads.