[Python-ideas] Adding a subprocess.CompletedProcess class

Wes Turner wes.turner at gmail.com
Mon Feb 2 02:50:13 CET 2015


On Feb 1, 2015 4:06 PM, "Paul Moore" <p.f.moore at gmail.com> wrote:
>
> On 1 February 2015 at 16:29, Wes Turner <wes.turner at gmail.com> wrote:
> >> The thing I've ended up needing to do once or twice, which is
> >> unreasonably hard with subprocess, is to run the command and capture
> >> the output, but *still* write it to stdout/stderr. So the user gets to
> >> see the command's progress, but you can introspect the results
> >> afterwards.
> >>
> >>
> >> The hard bit is to do this while still displaying the output as it
> >> arrives. You basically need to manage the stdout and stderr pipes
> >> yourself, do nasty multi-stream interleaving, and deal with the
> >> encoding/universal_newlines stuff on the captured data. In a
> >> cross-platform way :-(
> >
> > http://sarge.readthedocs.org/en/latest/tutorial.html#buffering-issues
>
> I'm not sure how that's relevant. Sure, if the child buffers output
> there's a delay in seeing it, but that's no more an issue than it
> would be for display on the console.

Ah. The link on that page that I was looking for was probably "Using
Redirection" #using-redirection and/or " Capturing stdout and stderr from
commands" #capturing-stdout-and-stderr-from-commands
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150201/038df574/attachment.html>


More information about the Python-ideas mailing list