When making calls of the form Popen(cmd, shell=True,The subprocess module has already an API method for your use case. The
stdout=subprocess.PIPE), we've been getting occasional, predictable
hangs. Will Popen accumulate a certain amount of stdout and then block
until its read? We don't want to use threads, so just want to read the
entire stdout after the subprocess has finished.
communicate() method of a subprocess.Popen instance takes an optional
stdin string and returns the stdout and stderr output as strings. The
method uses the best low level functions possible (select() on Unix,
threads on Windows).
Christian