Skip to content

Instantly share code, notes, and snippets.

@agronholm
Created January 7, 2017 19:48
Show Gist options
  • Save agronholm/b19b317f4ea3a249202752347f65d1e9 to your computer and use it in GitHub Desktop.
Save agronholm/b19b317f4ea3a249202752347f65d1e9 to your computer and use it in GitHub Desktop.
Small script to trigger error in StreamReader
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