[New-bugs-announce] [issue23342] run() - unified high-level interface for subprocess

Thomas Kluyver report at bugs.python.org
Wed Jan 28 23:13:38 CET 2015


New submission from Thomas Kluyver:

This follows on from the python-ideas thread starting here: https://mail.python.org/pipermail/python-ideas/2015-January/031479.html

subprocess gains:

- A CompletedProcess class representing a process that has finished, with attributes args, returncode, stdout and stderr
- A run() function which runs a process to completion and returns a CompletedProcess instance, aiming to unify the functionality of call, check_call and check_output
- CalledProcessError and TimeoutExceeded now have a stderr attribute, to avoid throwing away potentially relevant information.

Things I'm not sure about:

1. Should run() capture stdout/stderr 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.

----------
components: Library (Lib)
files: subprocess_run.patch
keywords: patch
messages: 234918
nosy: takluyver
priority: normal
severity: normal
status: open
title: run() - unified high-level interface for subprocess
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37897/subprocess_run.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23342>
_______________________________________


More information about the New-bugs-announce mailing list