(message)
| 419 | # asyncio issue #209: stdin must not be inheritable, otherwise |
| 420 | # the Process.communicate() hangs |
| 421 | async def len_message(message): |
| 422 | code = 'import sys; data = sys.stdin.read(); print(len(data))' |
| 423 | proc = await asyncio.create_subprocess_exec( |
| 424 | sys.executable, '-c', code, |
| 425 | stdin=asyncio.subprocess.PIPE, |
| 426 | stdout=asyncio.subprocess.PIPE, |
| 427 | stderr=asyncio.subprocess.PIPE, |
| 428 | close_fds=False, |
| 429 | ) |
| 430 | stdout, stderr = await proc.communicate(message) |
| 431 | exitcode = await proc.wait() |
| 432 | return (stdout, exitcode) |
| 433 | |
| 434 | output, exitcode = self.loop.run_until_complete(len_message(b'abc')) |
| 435 | self.assertEqual(output.rstrip(), b'3') |
nothing calls this directly
no test coverage detected