Recorded merge of revisions 76925 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76925 | georg.brandl | 2009-12-20 15:33:20 +0100 (So, 20 Dez 2009) | 1 line
#7381: subprocess documentation and library docstring consistency fixes.
........
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index 93ad19c..93c1ed0 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -105,10 +105,9 @@
.. note::
- If specified, *env* must provide any variables required
- for the program to execute. On Windows, in order to run a
- `side-by-side assembly`_ the specified *env* **must** include a valid
- :envvar:`SystemRoot`.
+ If specified, *env* must provide any variables required for the program to
+ execute. On Windows, in order to run a `side-by-side assembly`_ the
+ specified *env* **must** include a valid :envvar:`SystemRoot`.
.. _side-by-side assembly: http://en.wikipedia.org/wiki/Side-by-Side_Assembly
@@ -157,7 +156,7 @@
The arguments are the same as for the Popen constructor. Example::
- retcode = call(["ls", "-l"])
+ >>> retcode = subprocess.call(["ls", "-l"])
.. warning::
@@ -176,7 +175,8 @@
The arguments are the same as for the Popen constructor. Example::
- check_call(["ls", "-l"])
+ >>> subprocess.check_call(["ls", "-l"])
+ 0
.. warning::
@@ -195,15 +195,15 @@
The arguments are the same as for the :class:`Popen` constructor. Example::
>>> subprocess.check_output(["ls", "-l", "/dev/null"])
- 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
+ b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
The stdout argument is not allowed as it is used internally.
To capture standard error in the result, use ``stderr=subprocess.STDOUT``::
>>> subprocess.check_output(
- ["/bin/sh", "-c", "ls non_existent_file ; exit 0"],
- stderr=subprocess.STDOUT)
- 'ls: non_existent_file: No such file or directory\n'
+ ... ["/bin/sh", "-c", "ls non_existent_file; exit 0"],
+ ... stderr=subprocess.STDOUT)
+ b'ls: non_existent_file: No such file or directory\n'
.. versionadded:: 3.1
@@ -217,7 +217,6 @@
stripped from the output. The exit status for the command can be interpreted
according to the rules for the C function :cfunc:`wait`. Example::
- >>> import subprocess
>>> subprocess.getstatusoutput('ls /bin/ls')
(0, '/bin/ls')
>>> subprocess.getstatusoutput('cat /bin/junk')
@@ -234,7 +233,6 @@
Like :func:`getstatusoutput`, except the exit status is ignored and the return
value is a string containing the command's output. Example::
- >>> import subprocess
>>> subprocess.getoutput('ls /bin/ls')
'/bin/ls'