From 07171242d5ea3bc56a05a548ffa2deb9e0e5420d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 24 Feb 2014 13:18:47 +0100 Subject: [PATCH 1/2] subprocess.Popen.wait doc: mention asyncio to avoid busy loop --- Doc/library/subprocess.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 1a9dd9d390a..f03c3229423 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -629,6 +629,12 @@ Instances of the :class:`Popen` class have the following methods: :exc:`TimeoutExpired` exception. It is safe to catch this exception and retry the wait. + .. note:: + + The function is implemented using a busy loop (non-blocking call and + short sleeps). Use the :mod:`asyncio` module for an asynchronous wait: + see :class:`asyncio.create_subprocess_exec`. + .. warning:: This will deadlock when using ``stdout=PIPE`` and/or From de0e1d30d8a59edc49232ae13b2e2c243442dd32 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 24 Feb 2014 13:19:19 +0100 Subject: [PATCH 2/2] asyncio doc: fix references in subprocess doc --- Doc/library/asyncio-subprocess.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst index 5e6e657e3e4..f1f7bd9ea37 100644 --- a/Doc/library/asyncio-subprocess.rst +++ b/Doc/library/asyncio-subprocess.rst @@ -8,14 +8,14 @@ Create a subprocess .. function:: create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None, loop=None, limit=None, \*\*kwds) - Run the shell command *cmd* given as a string. Return a :class:`Process` + Run the shell command *cmd* given as a string. Return a :class:`~asyncio.subprocess.Process` instance. This function returns a :ref:`coroutine object `. .. function:: create_subprocess_exec(\*args, stdin=None, stdout=None, stderr=None, loop=None, limit=None, \*\*kwds) - Create a subprocess. Return a :class:`Process` instance. + Create a subprocess. Return a :class:`~asyncio.subprocess.Process` instance. This function returns a :ref:`coroutine object `.