diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-06-28 22:47:28 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-06-28 22:47:28 (GMT) |
commit | 6cdcf0d5ed565c5ec3a36331e64fbf230550543a (patch) | |
tree | f8ecb5acfd3e9b5999d3ed7bd42eefba8282f177 /Lib/asyncio/subprocess.py | |
parent | 41c8da95f4ed6e08e6f904ee11ca7cef074541a9 (diff) | |
parent | f951d28ac890063e3ecef56aa8cf851b1152d9dd (diff) | |
download | cpython-6cdcf0d5ed565c5ec3a36331e64fbf230550543a.zip cpython-6cdcf0d5ed565c5ec3a36331e64fbf230550543a.tar.gz cpython-6cdcf0d5ed565c5ec3a36331e64fbf230550543a.tar.bz2 |
(Merge 3.4) asyncio: sync with Tulip, add a new asyncio.coroutines module
Diffstat (limited to 'Lib/asyncio/subprocess.py')
-rw-r--r-- | Lib/asyncio/subprocess.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py index 414e023..2cd6de6 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): |