summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-12-20 14:38:23 (GMT)
committerGeorg Brandl <georg@python.org>2009-12-20 14:38:23 (GMT)
commit2708f3a53abcdfe4c0793acd04a5b53c7372608d (patch)
treed913c42affb153731a540fddb1d36a796dad15f7 /Doc
parent99de48894920c8e0a3d4e578307ee546ae605ca6 (diff)
downloadcpython-2708f3a53abcdfe4c0793acd04a5b53c7372608d.zip
cpython-2708f3a53abcdfe4c0793acd04a5b53c7372608d.tar.gz
cpython-2708f3a53abcdfe4c0793acd04a5b53c7372608d.tar.bz2
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. ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/subprocess.rst22
1 files changed, 10 insertions, 12 deletions
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 @@ This module defines one class called :class:`Popen`:
.. 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 @@ This module also defines four shortcut functions:
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 @@ This module also defines four shortcut functions:
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 @@ This module also defines four shortcut functions:
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 @@ This module also defines four shortcut functions:
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 @@ This module also defines four shortcut functions:
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'