I need to run a program and gather its output to stdout. This program (socat) needs to run in the background for the duration of the python script. Socat sits in dameon mode
The subprocess probably never closes stdout, so the read() call waits forever. To make matters worse, it will probably buffer its output when it figures out that it's a pipe instead of a console (the standard C library does this automatically, so this isn't a function of how cleverly written the app is). If so, probably the only option is to use an expect-style library such as Pexpect.