Skip to content

Commit 89e914e

Browse files
committed
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.
1 parent 2268e76 commit 89e914e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ui-macos/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def _try_wait(self, options):
8787
return self.rv
8888

8989
def wait(self):
90-
return self._try_wait(0)
90+
rv = None
91+
while rv is None:
92+
self.gotdata(None)
93+
rv = self._try_wait(os.WNOHANG)
9194

9295
def poll(self):
9396
return self._try_wait(os.WNOHANG)

0 commit comments

Comments
 (0)