[issue10197] subprocess.getoutput fails on win32

STINNER Victor report at bugs.python.org
Thu Mar 3 14:18:55 CET 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

subprocess_getoutput.patch: patch subprocess.getstatusoutput() to use directly Popen, instead of os.popen, with stderr=subprocess.STDOUT instead of "2>&1" shell redirection. It strips also all trailing spaces and newlines, not just the last one. And finally, it removes "Availability: UNIX." from the documentation.

I tried to add a shell argument (to be able to disable the shell) and to accept any Popen keyword, but I don't know how to implement shell=False if the input is a list of arguments. list2cmdline() is unsafe on UNIX (see #8972). And if getstatusoutput() doesn't accept argument list, it becomes useless with shell=False (it doesn't support to call a program with arguments).

Note: the status is still shifted on UNIX to be compatible with the wait() format.

----------
keywords: +patch
Added file: http://bugs.python.org/file20985/subprocess_getoutput.patch

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


More information about the Python-bugs-list mailing list