ui-macos/main.py: fix wait() to avoid deadlock.

If the subprocess was trying to write to its stdout/stderr, its process
would never actually finish because it was blocked waiting for us to read
it, but we were blocked on waitpid().  Instead, use waitpid(WNOHANG) and
continually read from the subprocess (which should be a blocking operation)
until it exits.
This commit is contained in:
Avery Pennarun 2012-01-02 18:46:30 -05:00 committed by Brian May
parent 3eef3635ac
commit 5a39341d50

View File

@ -97,7 +97,10 @@ class Runner:
return self.rv
def wait(self):
return self._try_wait(0)
rv = None
while rv is None:
self.gotdata(None)
rv = self._try_wait(os.WNOHANG)
def poll(self):
return self._try_wait(os.WNOHANG)