mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-04-22 18:28:24 +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
3eef3635ac
commit
5a39341d50
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user