I'm using python's subprocess module to interact with a program via the stdin and stdout pipes. If I call the subprocesses readline() on stdout, it hangs because it is waiting for a newline.
How can I do a read of all the characters in the stdout pipe of a subprocess instance? If it matters, I'm running in Linux.
Someone else appears to have had the same problem, you can see the related discussion here.
If you are running on Linux you can use select to wait for input on the process' stdout. Alternatively you change the mode of the process' stdout to non-blocking using
import fcntl, os fcntl.fcntl(your_process.stdout, fcntl.F_SETFL, os.O_NONBLOCK)
after which you can loop using read() until you encounter a newline character (if you want to process the output one line at a time).
You should loop using read() against a set number of characters.