Mercurial > cpython-lru_cache-weakref
diff Lib/subprocess.py @ 86941:0aa2aedc6a21
Issue #10197 Tweak docs for subprocess.getstatusoutput and align the documentation, the module docstring, and the function docstring.
| author | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| date | Tue, 05 Nov 2013 12:57:25 +0000 |
| parents | 05ce1bd1a4c2 |
| children | 71b618f0c8e9 |
line wrap: on
line diff
--- a/Lib/subprocess.py Tue Nov 05 02:50:49 2013 -0800 +++ b/Lib/subprocess.py Tue Nov 05 12:57:25 2013 +0000 @@ -145,11 +145,13 @@ getstatusoutput(cmd): Return (status, output) of executing cmd in a shell. - Execute the string 'cmd' in a shell with os.popen() and return a 2-tuple - (status, output). cmd is actually run as '{ cmd ; } 2>&1', so that the - returned output will contain output or error messages. 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 wait(). Example: + Execute the string 'cmd' in a shell with 'check_output' and + return a 2-tuple (status, output). Universal newlines mode is used, + meaning that the result with be decoded to a string. + + A trailing newline is stripped from the output. + The exit status for the command can be interpreted + according to the rules for the function 'wait'. Example: >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') @@ -684,13 +686,15 @@ # NB This only works (and is only relevant) for POSIX. def getstatusoutput(cmd): - """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 os.popen() and return a 2-tuple - (status, output). cmd is actually run as '{ cmd ; } 2>&1', so that the - returned output will contain output or error messages. 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 wait(). Example: + Execute the string 'cmd' in a shell with 'check_output' and + return a 2-tuple (status, output). Universal newlines mode is used, + meaning that the result with be decoded to a string. + + A trailing newline is stripped from the output. + The exit status for the command can be interpreted + according to the rules for the function 'wait'. Example: >>> import subprocess >>> subprocess.getstatusoutput('ls /bin/ls')
