Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2964138

Browse files
committed
Issue #10197: Indicate availability of subprocess.get[status]output on Windows and add a note about the effects of universal newlines
2 parents af73496 + 3a2abb5 commit 2964138

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

Doc/library/subprocess.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,10 +1058,12 @@ handling consistency are valid for these functions.
10581058

10591059
Return ``(status, output)`` of executing *cmd* in a shell.
10601060

1061-
Execute the string *cmd* in a shell with :func:`os.popen` and return a 2-tuple
1062-
``(status, output)``. *cmd* is actually run as ``{ cmd ; } 2>&1``, so that the
1063-
returned output will contain output or error messages. A trailing newline is
1064-
stripped from the output. The exit status for the command can be interpreted
1061+
Execute the string *cmd* in a shell with :class:`Popen` and return a 2-tuple
1062+
``(status, output)`` via :func:`Popen.communicate`. Universal newlines mode
1063+
is used; see the notes on :ref:`frequently-used-arguments` for more details.
1064+
1065+
A trailing newline is stripped from the output.
1066+
The exit status for the command can be interpreted
10651067
according to the rules for the C function :c:func:`wait`. Example::
10661068

10671069
>>> subprocess.getstatusoutput('ls /bin/ls')
@@ -1071,7 +1073,8 @@ handling consistency are valid for these functions.
10711073
>>> subprocess.getstatusoutput('/bin/junk')
10721074
(256, 'sh: /bin/junk: not found')
10731075

1074-
Availability: UNIX.
1076+
.. versionchanged:: 3.3
1077+
Availability: Unix & Windows
10751078

10761079

10771080
.. function:: getoutput(cmd)
@@ -1084,7 +1087,8 @@ handling consistency are valid for these functions.
10841087
>>> subprocess.getoutput('ls /bin/ls')
10851088
'/bin/ls'
10861089

1087-
Availability: UNIX.
1090+
.. versionchanged:: 3.3
1091+
Availability: Unix & Windows
10881092

10891093

10901094
Notes

0 commit comments

Comments
 (0)