Created
January 7, 2017 19:48
-
-
Save agronholm/b19b317f4ea3a249202752347f65d1e9 to your computer and use it in GitHub Desktop.
Small script to trigger error in StreamReader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
async def execute(): | |
process = await asyncio.create_subprocess_exec( | |
"timeout", "0.1", "cat", "/dev/urandom", stdout=asyncio.subprocess.PIPE) | |
while True: | |
data = await process.stdout.read(65536) | |
print('read %d bytes' % len(data)) | |
if data: | |
await asyncio.sleep(0.3) | |
else: | |
break | |
asyncio.get_event_loop().run_until_complete(execute()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment