bpo-33649: Polish asyncio subprocess and sync docs (GH-9285) · python/cpython@4e824e9

@@ -62,8 +62,7 @@ Creating Subprocesses

62626363

The *limit* argument sets the buffer limit for :class:`StreamReader`

6464

wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`

65-

(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr*

66-

arguments).

65+

(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).

67666867

Return a :class:`~asyncio.subprocess.Process` instance.

6968

@@ -78,15 +77,14 @@ Creating Subprocesses

78777978

The *limit* argument sets the buffer limit for :class:`StreamReader`

8079

wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`

81-

(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr*

82-

arguments).

80+

(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).

83818482

Return a :class:`~asyncio.subprocess.Process` instance.

85838684

See the documentation of :meth:`loop.subprocess_shell` for other

8785

parameters.

888689-

.. note::

87+

.. important::

90889189

It is the application's responsibility to ensure that all whitespace and

9290

metacharacters are quoted appropriately to avoid `shell injection

@@ -98,7 +96,8 @@ Creating Subprocesses

9896

.. note::

999710098

The default event loop that asyncio is pre-configured

101-

to use on **Windows** does not support subprocesses.

99+

to use on **Windows** does not support subprocesses. Subprocesses are

100+

available for Windows if the :class:`ProactorEventLoop` is used.

102101

See :ref:`Subprocess Support on Windows <asyncio-windows-subprocess>`

103102

for details.

104103

@@ -206,7 +205,7 @@ communicate with them.

206205

exception is ignored. This condition occurs when the process

207206

exits before all data are written into *stdin*.

208207209-

If its desired to send data to the process' *stdin*,

208+

If it is desired to send data to the process' *stdin*,

210209

the process needs to be created with ``stdin=PIPE``. Similarly,

211210

to get anything other than ``None`` in the result tuple, the

212211

process has to be created with ``stdout=PIPE`` and/or

@@ -265,8 +264,8 @@ communicate with them.

265264

Use the :meth:`communicate` method rather than

266265

:attr:`process.stdin.write() <stdin>`,

267266

:attr:`await process.stdout.read() <stdout>` or

268-

:attr:`await process.stderr.read <stderr>`

269-

to avoid deadlocks due to streams pausing reading or writing

267+

:attr:`await process.stderr.read <stderr>`.

268+

This avoids deadlocks due to streams pausing reading or writing

270269

and blocking the child process.

271270272271

.. attribute:: pid