04.04.19 11:59, Greg Ewing пише:
Nathaniel Smith wrote:
On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing <greg.ew...@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()


check_output() is currently implemented (besides arguments checks and legacy support) as just

    run(..., stdout=PIPE, check=True).stdout

For getting unchecked output you need just to omit check=True.

    run(..., stdout=PIPE).stdout

I think that after adding run() there is no need in output().

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to