In the document of wait (http://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait), it says:
Warning
This will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use communicate() to avoid that.
From this, I think communicate
could replace all usage of wait()
if retcode
is not need. And even when the stdout
or stdin
are not PIPE, I can also replace wait()
by communicate()
.
Is that right? Thanks!