diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-06 00:22:54 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-06 00:22:54 (GMT) |
commit | 4ae5467134b49581f3a8e33f1ed4f33ff19cfa8b (patch) | |
tree | 377a2522ef01efcdb90ed343b79c6472106569b8 | |
parent | 43a85343649fda4d3f7b56d71bafd01ce88f0b99 (diff) | |
parent | 212994e4e2ed023267ebfceeae541c8aa4257806 (diff) | |
download | cpython-4ae5467134b49581f3a8e33f1ed4f33ff19cfa8b.zip cpython-4ae5467134b49581f3a8e33f1ed4f33ff19cfa8b.tar.gz cpython-4ae5467134b49581f3a8e33f1ed4f33ff19cfa8b.tar.bz2 |
Merge 3.4 (asyncio)
-rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index dfe23be..1fe9095 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -227,20 +227,18 @@ class SubprocessMixin: # Issue #23140: cancel Process.wait() @asyncio.coroutine - def wait_proc(proc, event): - event.set() - yield from proc.wait() - - @asyncio.coroutine def cancel_wait(): proc = yield from asyncio.create_subprocess_exec( *PROGRAM_BLOCKED, loop=self.loop) # Create an internal future waiting on the process exit - event = asyncio.Event(loop=self.loop) - task = self.loop.create_task(wait_proc(proc, event)) - yield from event.wait() + task = self.loop.create_task(proc.wait()) + self.loop.call_soon(task.cancel) + try: + yield from task + except asyncio.CancelledError: + pass # Cancel the future task.cancel() |