mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-06-20 09:57:42 +02:00
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:
parent
2268e76771
commit
89e914e9d1
@ -87,7 +87,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user