mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Issue #10197: Indicate availability of subprocess.get[status]output on Windows and add a note about the effects of universal newlines
This commit is contained in:
parent
0de4d3e3eb
commit
3a2abb5800
1 changed files with 10 additions and 6 deletions
|
@ -1050,10 +1050,12 @@ handling consistency are valid for these functions.
|
||||||
|
|
||||||
Return ``(status, output)`` of executing *cmd* in a shell.
|
Return ``(status, output)`` of executing *cmd* in a shell.
|
||||||
|
|
||||||
Execute the string *cmd* in a shell with :func:`os.popen` and return a 2-tuple
|
Execute the string *cmd* in a shell with :class:`Popen` and return a 2-tuple
|
||||||
``(status, output)``. *cmd* is actually run as ``{ cmd ; } 2>&1``, so that the
|
``(status, output)`` via :func:`Popen.communicate`. Universal newlines mode
|
||||||
returned output will contain output or error messages. A trailing newline is
|
is used; see the notes on :ref:`frequently-used-arguments` for more details.
|
||||||
stripped from the output. The exit status for the command can be interpreted
|
|
||||||
|
A trailing newline is stripped from the output.
|
||||||
|
The exit status for the command can be interpreted
|
||||||
according to the rules for the C function :c:func:`wait`. Example::
|
according to the rules for the C function :c:func:`wait`. Example::
|
||||||
|
|
||||||
>>> subprocess.getstatusoutput('ls /bin/ls')
|
>>> subprocess.getstatusoutput('ls /bin/ls')
|
||||||
|
@ -1063,7 +1065,8 @@ handling consistency are valid for these functions.
|
||||||
>>> subprocess.getstatusoutput('/bin/junk')
|
>>> subprocess.getstatusoutput('/bin/junk')
|
||||||
(256, 'sh: /bin/junk: not found')
|
(256, 'sh: /bin/junk: not found')
|
||||||
|
|
||||||
Availability: UNIX.
|
.. versionchanged:: 3.3
|
||||||
|
Availability: Unix & Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: getoutput(cmd)
|
.. function:: getoutput(cmd)
|
||||||
|
@ -1076,7 +1079,8 @@ handling consistency are valid for these functions.
|
||||||
>>> subprocess.getoutput('ls /bin/ls')
|
>>> subprocess.getoutput('ls /bin/ls')
|
||||||
'/bin/ls'
|
'/bin/ls'
|
||||||
|
|
||||||
Availability: UNIX.
|
.. versionchanged:: 3.3
|
||||||
|
Availability: Unix & Windows
|
||||||
|
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue