summaryrefslogtreecommitdiff
path: root/Lib/asyncio/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-29 00:46:45 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-06-29 00:46:45 +0200
commitf951d28ac890063e3ecef56aa8cf851b1152d9dd (patch)
tree71e7b4d00127750cdfff1bce277012622fe2b719 /Lib/asyncio/subprocess.py
parent61f32cb5b8358b02c45e0a256c16e505e4c371d2 (diff)
downloadcpython-git-f951d28ac890063e3ecef56aa8cf851b1152d9dd.tar.gz
asyncio: sync with Tulip, add a new asyncio.coroutines module
Diffstat (limited to 'Lib/asyncio/subprocess.py')
-rw-r--r--Lib/asyncio/subprocess.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
index 414e02383e..2cd6de6d6f 100644
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -8,6 +8,7 @@ from . import futures
from . import protocols
from . import streams
from . import tasks
+from .coroutines import coroutine
PIPE = subprocess.PIPE
@@ -94,7 +95,7 @@ class Process:
def returncode(self):
return self._transport.get_returncode()
- @tasks.coroutine
+ @coroutine
def wait(self):
"""Wait until the process exit and return the process return code."""
returncode = self._transport.get_returncode()
@@ -122,17 +123,17 @@ class Process:
self._check_alive()
self._transport.kill()
- @tasks.coroutine
+ @coroutine
def _feed_stdin(self, input):
self.stdin.write(input)
yield from self.stdin.drain()
self.stdin.close()
- @tasks.coroutine
+ @coroutine
def _noop(self):
return None
- @tasks.coroutine
+ @coroutine
def _read_stream(self, fd):
transport = self._transport.get_pipe_transport(fd)
if fd == 2:
@@ -144,7 +145,7 @@ class Process:
transport.close()
return output
- @tasks.coroutine
+ @coroutine
def communicate(self, input=None):
if input:
stdin = self._feed_stdin(input)
@@ -164,7 +165,7 @@ class Process:
return (stdout, stderr)
-@tasks.coroutine
+@coroutine
def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
loop=None, limit=streams._DEFAULT_LIMIT, **kwds):
if loop is None:
@@ -178,7 +179,7 @@ def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
yield from protocol.waiter
return Process(transport, protocol, loop)
-@tasks.coroutine
+@coroutine
def create_subprocess_exec(program, *args, stdin=None, stdout=None,
stderr=None, loop=None,
limit=streams._DEFAULT_LIMIT, **kwds):