diff options
author | Tim Golden <mail@timgolden.me.uk> | 2013-11-05 12:57:25 (GMT) |
---|---|---|
committer | Tim Golden <mail@timgolden.me.uk> | 2013-11-05 12:57:25 (GMT) |
commit | 607981402cba9dc783eb8a934d9814c77b824c6b (patch) | |
tree | 749d04d4b4cab5fd9497e51438a7b58126ede9df /Lib/subprocess.py | |
parent | be47cffcb2b93c6d269d45ac0e18700e566b79fd (diff) | |
download | cpython-607981402cba9dc783eb8a934d9814c77b824c6b.zip cpython-607981402cba9dc783eb8a934d9814c77b824c6b.tar.gz cpython-607981402cba9dc783eb8a934d9814c77b824c6b.tar.bz2 |
Issue #10197 Tweak docs for subprocess.getstatusoutput and align the documentation, the module docstring, and the function docstring.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 1bfd136..5b2811f 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -145,11 +145,13 @@ check_call(*popenargs, **kwargs): 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 @@ def list2cmdline(seq): # 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 'check_output' and + return a 2-tuple (status, output). Universal newlines mode is used, + meaning that the result with be decoded to a string. - 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: + 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') |