Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53281b1

Browse files
committed
asyncio.docs: Document subprocess_exec and subprocess_shell. Issue #20694.
1 parent 0c9beb6 commit 53281b1

1 file changed

Lines changed: 49 additions & 5 deletions

File tree

Doc/library/asyncio-eventloop.rst

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,17 +467,61 @@ Run subprocesses asynchronously using the :mod:`subprocess` module.
467467
:class:`SelectSelector` or :class:`PollSelector` to handle character devices
468468
on Mac OS X 10.6 (Snow Leopard) and later.
469469

470-
.. method:: BaseEventLoop.subprocess_exec(protocol_factory, \*args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, shell=False, bufsize=0, \*\*kwargs)
471-
472-
XXX
470+
.. method:: BaseEventLoop.subprocess_exec(protocol_factory, \*args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, \*\*kwargs)
471+
472+
Create a subprocess from one or more string arguments, where the first string
473+
specifies the program to execute, and the remaining strings specify the
474+
program's arguments. (Thus, together the string arguments form the
475+
``sys.argv`` value of the program, assuming it is a Python script.) This is
476+
similar to the standard library :class:`subprocess.Popen` class called with
477+
shell=False and the list of strings passed as the first argument;
478+
however, where :class:`~subprocess.Popen` takes a single argument which is
479+
list of strings, :func:`subprocess_exec` takes multiple string arguments.
480+
481+
Other parameters:
482+
483+
* *stdin*: Either a file-like object representing the pipe to be connected
484+
to the subprocess's standard input stream using
485+
:meth:`~BaseEventLoop.connect_write_pipe`, or the constant
486+
:const:`subprocess.PIPE` (the default). By default a new pipe will be
487+
created and connected.
488+
489+
* *stdout*: Either a file-like object representing the pipe to be connected
490+
to the subprocess's standard output stream using
491+
:meth:`~BaseEventLoop.connect_write_pipe`, or the constant
492+
:const:`subprocess.PIPE` (the default). By default a new pipe will be
493+
created and connected.
494+
495+
* *stderr*: Either a file-like object representing the pipe to be connected
496+
to the subprocess's standard error stream using
497+
:meth:`~BaseEventLoop.connect_read_pipe`, or one of the constants
498+
:const:`subprocess.PIPE` (the default) or :const:`subprocess.STDOUT`.
499+
By default a new pipe will be created and connected. When
500+
:const:`subprocess.STDOUT` is specified, the subprocess's standard error
501+
stream will be connected to the same pipe as the standard output stream.
502+
503+
* All other keyword arguments are passed to :class:`subprocess.Popen`
504+
without interpretation, except for *bufsize*, *universal_newlines* and
505+
*shell*, which should not be specified at all.
506+
507+
Returns a pair of ``(transport, protocol)``, where *transport* is an
508+
instance of :class:`BaseSubprocessTransport`.
473509

474510
This method is a :ref:`coroutine <coroutine>`.
475511

476512
See the constructor of the :class:`subprocess.Popen` class for parameters.
477513

478-
.. method:: BaseEventLoop.subprocess_shell(protocol_factory, cmd, \*, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, shell=True, bufsize=0, \*\*kwargs)
514+
.. method:: BaseEventLoop.subprocess_shell(protocol_factory, cmd, \*, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, \*\*kwargs)
515+
516+
Create a subprocess from *cmd*, which is a string using the platform's
517+
"shell" syntax. This is similar to the standard library
518+
:class:`subprocess.Popen` class called with ``shell=True``.
519+
520+
See :meth:`~BaseEventLoop.subprocess_exec` for more details about
521+
the remaining arguments.
479522

480-
XXX
523+
Returns a pair of ``(transport, protocol)``, where *transport* is an
524+
instance of :class:`BaseSubprocessTransport`.
481525

482526
This method is a :ref:`coroutine <coroutine>`.
483527

0 commit comments

Comments
 (0)