Revert "A better fix for asyncio test_stdin_broken_pipe (#7221)" by 1st1 · Pull Request #7235 · python/cpython
# the program ends before the stdin can be feeded create = asyncio.create_subprocess_exec( sys.executable, '-c', 'print("hello", flush=True)', sys.executable, '-c', 'pass', stdin=subprocess.PIPE, stdout=subprocess.PIPE, loop=self.loop) proc = self.loop.run_until_complete(create) return (proc, large_data)
async def write_stdin(proc, data): await proc.stdout.readline() await asyncio.sleep(0.5, loop=self.loop) proc.stdin.write(data) await proc.stdin.drain()