summaryrefslogtreecommitdiffstats
path: root/Doc/library/subprocess.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-06 07:17:29 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-06 07:17:29 (GMT)
commit8ffe0bc55fff676dc758da54e7dd35edd45c8cb8 (patch)
tree43985217a9c8212c436ad07db2ca1682d69bbc27 /Doc/library/subprocess.rst
parent107690c2ff6ad95934b66df2d2566177b7560827 (diff)
downloadcpython-8ffe0bc55fff676dc758da54e7dd35edd45c8cb8.zip
cpython-8ffe0bc55fff676dc758da54e7dd35edd45c8cb8.tar.gz
cpython-8ffe0bc55fff676dc758da54e7dd35edd45c8cb8.tar.bz2
Merged revisions 76923,76926,77009,77082-77083,77085,77087,77121 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ................ r76923 | georg.brandl | 2009-12-20 15:24:06 +0100 (So, 20 Dez 2009) | 1 line #7493: more review fixes. ................ r76926 | georg.brandl | 2009-12-20 15:38:23 +0100 (So, 20 Dez 2009) | 9 lines 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. ........ ................ r77009 | georg.brandl | 2009-12-23 11:30:45 +0100 (Mi, 23 Dez 2009) | 1 line #7417: add signature to open() docstring. ................ r77082 | georg.brandl | 2009-12-28 08:59:20 +0100 (Mo, 28 Dez 2009) | 1 line #7577: fix signature info for getbufferproc. ................ r77083 | georg.brandl | 2009-12-28 09:00:47 +0100 (Mo, 28 Dez 2009) | 9 lines Merged revisions 77081 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77081 | georg.brandl | 2009-12-28 08:59:05 +0100 (Mo, 28 Dez 2009) | 1 line #7577: fix signature of PyBuffer_FillInfo(). ........ ................ r77085 | georg.brandl | 2009-12-28 09:02:38 +0100 (Mo, 28 Dez 2009) | 9 lines Merged revisions 77084 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77084 | georg.brandl | 2009-12-28 09:01:59 +0100 (Mo, 28 Dez 2009) | 1 line #7586: fix typo. ........ ................ r77087 | georg.brandl | 2009-12-28 09:10:38 +0100 (Mo, 28 Dez 2009) | 9 lines Recorded merge of revisions 77086 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77086 | georg.brandl | 2009-12-28 09:09:32 +0100 (Mo, 28 Dez 2009) | 1 line #7381: consistency update, and backport avoiding ``None >= 0`` check from py3k. ........ ................ r77121 | georg.brandl | 2009-12-29 22:38:35 +0100 (Di, 29 Dez 2009) | 1 line #7590: exception classes no longer are in the "exceptions" module. Also clean up text that was written with string exceptions in mind. ................
Diffstat (limited to 'Doc/library/subprocess.rst')
-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 72ea8c6..698e535 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -136,10 +136,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
@@ -188,7 +187,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::
@@ -206,7 +205,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::
@@ -225,15 +225,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
@@ -247,7 +247,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')
@@ -264,7 +263,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'