The subprocess will output several characters, and I want to send some response via stdin. The length of the output is predictable, so I wrote code like this:
p = Popen("myproc", shell = True, stdin = PIPE, stdout = PIPE)
p.stdout.read(1)
However, p.stdout.read(1)
doesn't return even if the process had already output more than a character. How can I make it stop blocking after reading a byte sequence of the expected length?