diff options
author | Seth M. Larson <SethMichaelLarson@users.noreply.github.com> | 2017-03-03 04:21:18 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@gmail.com> | 2017-03-03 04:21:18 (GMT) |
commit | 481cb70a724687d12553d38a749c16034af68a1e (patch) | |
tree | de7694fa41f50dca1b20e114030edf3cc6d11ae5 /Lib/test/test_asyncio | |
parent | 398ff91ac0b8f4d930cd5d9e3e6a4bf247f810ef (diff) | |
download | cpython-481cb70a724687d12553d38a749c16034af68a1e.zip cpython-481cb70a724687d12553d38a749c16034af68a1e.tar.gz cpython-481cb70a724687d12553d38a749c16034af68a1e.tar.bz2 |
bpo-29704: Fix asyncio.SubprocessStreamProtocol closing (#405)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index bba688b..407e8b6 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -459,6 +459,28 @@ class SubprocessMixin: self.loop.run_until_complete(create) self.assertEqual(warns, []) + def test_read_stdout_after_process_exit(self): + @asyncio.coroutine + def execute(): + code = '\n'.join(['import sys', + 'for _ in range(64):', + ' sys.stdout.write("x" * 4096)', + 'sys.stdout.flush()', + 'sys.exit(1)']) + + fut = asyncio.create_subprocess_exec(sys.executable, '-c', code, + stdout=asyncio.subprocess.PIPE, + loop=self.loop) + process = yield from fut + while True: + data = yield from process.stdout.read(65536) + if data: + yield from asyncio.sleep(0.3, loop=self.loop) + else: + break + + self.loop.run_until_complete(execute()) + if sys.platform != 'win32': # Unix |