summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-02-21 01:10:28 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-02-21 01:10:28 (GMT)
commit7a19355c7728005b9a267484fa8c41d7bde7e899 (patch)
treeb1f52e1a3c578aa18bdf5dcfd2e9c38a387a0e12 /Doc
parente8ebe152defbedd7ffd52ae4d970f70bdec38525 (diff)
downloadcpython-7a19355c7728005b9a267484fa8c41d7bde7e899.zip
cpython-7a19355c7728005b9a267484fa8c41d7bde7e899.tar.gz
cpython-7a19355c7728005b9a267484fa8c41d7bde7e899.tar.bz2
asyncio.docs: Document subprocess_exec and subprocess_shell. Issue #20694.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/asyncio-eventloop.rst54
1 files changed, 49 insertions, 5 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index 2e48d30..9d54964 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -467,17 +467,61 @@ Run subprocesses asynchronously using the :mod:`subprocess` module.
:class:`SelectSelector` or :class:`PollSelector` to handle character devices
on Mac OS X 10.6 (Snow Leopard) and later.
-.. method:: BaseEventLoop.subprocess_exec(protocol_factory, \*args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, shell=False, bufsize=0, \*\*kwargs)
-
- XXX
+.. method:: BaseEventLoop.subprocess_exec(protocol_factory, \*args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, \*\*kwargs)
+
+ Create a subprocess from one or more string arguments, where the first string
+ specifies the program to execute, and the remaining strings specify the
+ program's arguments. (Thus, together the string arguments form the
+ ``sys.argv`` value of the program, assuming it is a Python script.) This is
+ similar to the standard library :class:`subprocess.Popen` class called with
+ shell=False and the list of strings passed as the first argument;
+ however, where :class:`~subprocess.Popen` takes a single argument which is
+ list of strings, :func:`subprocess_exec` takes multiple string arguments.
+
+ Other parameters:
+
+ * *stdin*: Either a file-like object representing the pipe to be connected
+ to the subprocess's standard input stream using
+ :meth:`~BaseEventLoop.connect_write_pipe`, or the constant
+ :const:`subprocess.PIPE` (the default). By default a new pipe will be
+ created and connected.
+
+ * *stdout*: Either a file-like object representing the pipe to be connected
+ to the subprocess's standard output stream using
+ :meth:`~BaseEventLoop.connect_write_pipe`, or the constant
+ :const:`subprocess.PIPE` (the default). By default a new pipe will be
+ created and connected.
+
+ * *stderr*: Either a file-like object representing the pipe to be connected
+ to the subprocess's standard error stream using
+ :meth:`~BaseEventLoop.connect_read_pipe`, or one of the constants
+ :const:`subprocess.PIPE` (the default) or :const:`subprocess.STDOUT`.
+ By default a new pipe will be created and connected. When
+ :const:`subprocess.STDOUT` is specified, the subprocess's standard error
+ stream will be connected to the same pipe as the standard output stream.
+
+ * All other keyword arguments are passed to :class:`subprocess.Popen`
+ without interpretation, except for *bufsize*, *universal_newlines* and
+ *shell*, which should not be specified at all.
+
+ Returns a pair of ``(transport, protocol)``, where *transport* is an
+ instance of :class:`BaseSubprocessTransport`.
This method is a :ref:`coroutine <coroutine>`.
See the constructor of the :class:`subprocess.Popen` class for parameters.
-.. method:: BaseEventLoop.subprocess_shell(protocol_factory, cmd, \*, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, shell=True, bufsize=0, \*\*kwargs)
+.. method:: BaseEventLoop.subprocess_shell(protocol_factory, cmd, \*, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, \*\*kwargs)
+
+ Create a subprocess from *cmd*, which is a string using the platform's
+ "shell" syntax. This is similar to the standard library
+ :class:`subprocess.Popen` class called with ``shell=True``.
+
+ See :meth:`~BaseEventLoop.subprocess_exec` for more details about
+ the remaining arguments.
- XXX
+ Returns a pair of ``(transport, protocol)``, where *transport* is an
+ instance of :class:`BaseSubprocessTransport`.
This method is a :ref:`coroutine <coroutine>`.