saltstack/salt — pull request #9110 by pakdel (2013-12-08 20:56:47+00:00)
Title: Preventing deadlock on subprocess.Popen.poll()

According to
http://docs.python.org/2/library/subprocess.html#subprocess.Popen.poll

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.
We count consecutive iterations that do not have any output, and
only if it reaches a certain threshold, self.communicate() is run.