[New-bugs-announce] [issue32102] Add "capture_output=True" option to subprocess.run
Nick Coghlan
report at bugs.python.org
Tue Nov 21 01:13:47 EST 2017
New submission from Nick Coghlan <ncoghlan at gmail.com>:
I'm hesitant to suggest adding yet-another-option to any subprocess API, but I'm thinking it may be worth it in this case.
The idea is to make it possible to replace:
result = subprocess.run(cmd, stdout=PIPE, stderr=PIPE)
with:
result = subprocess.run(cmd, capture_output=True)
That way, it would be possible for the raw stdin/stdout/stderr parameters to be treated as low level implementation details most of the time, since the most common configurations would be:
# Use parent's stdin/stdout/stderr
result = subprocess.run(cmd)
# Use pipe for stdin, use parent's stdout/stderr
result = subprocess.run(cmd, input=data)
# Use parent's stdin, use pipe for stdout/stderr
result = subprocess.run(cmd, capture_output=True)
# Use pipe for stdin/stdout/stderr
result = subprocess.run(cmd, input=data, capture_output=True)
----------
messages: 306627
nosy: gregory.p.smith, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add "capture_output=True" option to subprocess.run
type: enhancement
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32102>
_______________________________________
More information about the New-bugs-announce
mailing list