Read the source code of asyncio/streams.py. There are helper classes that should let you do it. Please post the solution here.
On Thu, Jan 23, 2014 at 7:04 AM, Phil Schaf <trueflyingsh...@gmail.com> wrote: > hi, i opened a subprocess using > > transport, proto = yield from loop.subprocess_exec(SubprocessProtocol, > *mycmd) > > now, how do i write something to stdin asynchronously, and then react to > lines being written? basically: > > stdin = transport.get_pipe_transport(0) > stdin.write(msg) # this is backgrounded… coroutine version? > stdin.close() # and/or stdin.write_eof() > > reader = SomeKindOfReader(self.transport.get_pipe_transport(1)) > > while reader.can_read(): # not EOF or connection closed > response = yield from reader.readline() # should return when EOF or > conn. closed > do_sth_with(response) -- --Guido van Rossum (python.org/~guido)