I'm building a wrapper around a server cmd line script that should run indefinitely. What I need to do is to get the current stout without waiting for the subprocess to finish.
I mean, if I run the following, everything works fine:
ls = Popen(["ls"], stdout=PIPE)
output = ls.stdout.read()
But if I do the same with an indefinitelly running program:
server = Popen(["python","-m","SimpleHTTPServer"], stdout=PIPE)
output = server.stdout.read()
It will not come back...
Update: Even
output = server.stdout.read(1)
hangs...
Do you know if there's a way to capture partial output from a Popen (or similar threading implementation) in an OS independent way?