[Python-ideas] Adding a subprocess.CompletedProcess class

Thomas Kluyver thomas at kluyver.me.uk
Wed Jan 28 21:27:34 CET 2015

On 28 January 2015 at 10:02, Ethan Furman <ethan at stoneleaf.us> wrote:

> > It seems like there's some level of interest in this; shall I work on a
> patch?
> That would be great!

First pass at a patch attached. I also ended up adding stderr attributes to
CalledProcessError and TimeoutExceeded, so information is not thrown away.

Things I wasn't sure about:

1. Should stdout/stderr be captured by default? I opted not to, for
consistency with Popen and with shells.
2. I gave run() a check_returncode parameter, but it feels quite a long
name for a parameter. Is 'check' clear enough to use as the parameter name?
3. Popen has an 'args' attribute, while CalledProcessError and
TimeoutExpired have 'cmd'. CompletedProcess sits between those cases, so
which name should it use? For now, it's args.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150128/d08fd67f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subprocess_run.patch
Type: text/x-patch
Size: 27086 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150128/d08fd67f/attachment-0001.bin>

More information about the Python-ideas mailing list