Streams stdout/stderr to logger using threads
Streams stdout/stderr to logger using threads

subprocess.communicate() blocks and reads all the output into
memory before returning. It is safe in that it uses threads to
avoid deadlocks when capturing both stdout and stderr in a pipe.

This patch uses threads to read the stdout and stderr pipes, and
to log the output as it is generated. This approach continues to
avoid deadlocks, but also avoids blocking and reading all the output
into memory.

plus3it/watchmaker,plus3it/watchmaker