Kenneth McDonald wrote:
When making calls of the form Popen(cmd, shell=True, 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.
The subprocess module has already an API method for your use case. The 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 -- http://mail.python.org/mailman/listinfo/python-list