subprocess.Popen does not close pipe in an error case

Nobody nobody at
Sun Jan 10 08:51:02 CET 2010

On Wed, 06 Jan 2010 11:39:37 -0800, Steven K. Wong wrote:

> Suppose now all the prog1.poll() calls/loop are replaced by a single
> prog1.wait(). Without the explicit prog1.stdout.close(), prog1.wait()
> will not return, so the calling process still hangs. Because calling
> prog1.wait() means that the calling process will naturally never read
> prog1.stdout, I would argue that prog1.wait() should close the pipe
> before actually waiting for prog1 to exit. Makes sense?

prog1.stdout might be being read by a different thread.

More information about the Python-list mailing list