From 7280486ce34266047a54310435299de045c4d07f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 21 Mar 2014 11:44:49 +0100 Subject: [PATCH 1/2] Close #21005: Fix documentation of asyncio.subprocess.DEVNULL --- Doc/library/asyncio-subprocess.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst index 44ef5047148..26bc629452b 100644 --- a/Doc/library/asyncio-subprocess.rst +++ b/Doc/library/asyncio-subprocess.rst @@ -46,10 +46,9 @@ Constants .. data:: asyncio.subprocess.DEVNULL - Special value that can be used as the *stderr* argument to - :func:`create_subprocess_shell` and :func:`create_subprocess_exec` and - indicates that standard error should go into the same handle as standard - output. + Special value that can be used as the *stdin*, *stdout* or *stderr* argument + to :func:`create_subprocess_shell` and :func:`create_subprocess_exec` and + indicates that the special file :data:`os.devnull` will be used. Process From 6bc239619ce93840ac3a3379dcbb32baa8e94e0e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 21 Mar 2014 11:56:40 +0100 Subject: [PATCH 2/2] Issue #21006: Fix subprocess example on Windows in asyncio doc --- Doc/library/asyncio-subprocess.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst index 26bc629452b..37be849a01f 100644 --- a/Doc/library/asyncio-subprocess.rst +++ b/Doc/library/asyncio-subprocess.rst @@ -146,6 +146,7 @@ it does not use a shell. Get the output of the "python -m platform" command and display the output:: import asyncio + import os import sys from asyncio import subprocess @@ -164,7 +165,11 @@ display the output:: exitcode = yield from proc.wait() return (exitcode, stdout) - loop = asyncio.get_event_loop() + if os.name == 'nt': + loop = asyncio.ProactorEventLoop() + asyncio.set_event_loop(loop) + else: + loop = asyncio.get_event_loop() coro = getstatusoutput(sys.executable, '-m', 'platform') exitcode, stdout = loop.run_until_complete(coro) if not exitcode: