mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-07 06:13:03 -04:00
Properly handle KeyboardInterrupt exception in CLI in macOS
This commit is contained in:
parent
9be8169233
commit
a57703cb5a
1 changed files with 4 additions and 2 deletions
|
@ -199,8 +199,10 @@ def main(cwd=None):
|
||||||
|
|
||||||
# wait for app to close
|
# wait for app to close
|
||||||
while t.is_alive():
|
while t.is_alive():
|
||||||
# t.join() can't catch KeyboardInterrupt in such as Ubuntu
|
t.join()
|
||||||
t.join(0.5)
|
# allow KeyboardInterrupt exception to be handled with threads
|
||||||
|
# https://stackoverflow.com/questions/3788208/python-threading-ignores-keyboardinterrupt-exception
|
||||||
|
time.sleep(100)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
web.stop(app.port)
|
web.stop(app.port)
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue