[Python-ideas] Add output() helper function to subprocess module
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Apr 4 04:59:19 EDT 2019
Nathaniel Smith wrote:
> On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>>output(args) --> (status, output)
>
> Isn't this already available as: run(args, stdout=PIPE)?
Yes, but you need to do more than that to get the output
as a string. This is the relevant part of the implementation
of check_output():
process = Popen(stdout=PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
--
Greg
More information about the Python-ideas
mailing list