Commit 5a39341d authored by Avery Pennarun's avatar Avery Pennarun Committed by Brian May

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.
parent 3eef3635
...@@ -97,7 +97,10 @@ class Runner: ...@@ -97,7 +97,10 @@ class Runner:
return self.rv return self.rv
def wait(self): 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): def poll(self):
return self._try_wait(os.WNOHANG) return self._try_wait(os.WNOHANG)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment