Here is my best attempt at asynchronously reading stdin/stdout from a subprocess and printing it from Python:
import asyncio
import subprocess
from asyncio.subprocess import STDOUT, PIPE, DEVNULL
async def start_stream():
    return await asyncio.create_subprocess_shell(
        'watch ls /proc',
        stdout=PIPE,
        stderr=PIPE,
        limit=1024
    )
async def spawn():
    ev_proc = await start_stream()
    while True:
        stdout, stderr = await ev_proc.communicate()
        print(stdout, stderr)
if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(spawn())
Why is the print function not outputting anything?
 
     
    