diff options
author | mig5 <mig@mig5.net> | 2023-10-23 14:45:39 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-23 14:45:39 +1100 |
commit | f880a931bb955b1c9b3bd048fdcb7d56e45905c2 (patch) | |
tree | 420b66e15358d9abcf6bb57c36a124039f7c849a | |
parent | 9f247eddfd4d1aa3d804663cf548005880c61875 (diff) | |
parent | b2f0444f5729379667bcf085723467b3d40160c6 (diff) | |
download | onionshare-f880a931bb955b1c9b3bd048fdcb7d56e45905c2.tar.gz onionshare-f880a931bb955b1c9b3bd048fdcb7d56e45905c2.zip |
Merge pull request #1790 from onionshare/fix-waitress-stop-error
Raise error from waitress if not shutdown
-rw-r--r-- | cli/onionshare_cli/web/web.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/onionshare_cli/web/web.py b/cli/onionshare_cli/web/web.py index a6ccbeb0..3a15fdc1 100644 --- a/cli/onionshare_cli/web/web.py +++ b/cli/onionshare_cli/web/web.py @@ -365,7 +365,8 @@ class Web: ) self.waitress.run() except Exception as e: - raise WaitressException(f"Error starting Waitress: {e}") + if not self.waitress.shutdown: + raise WaitressException(f"Error starting Waitress: {e}") def stop(self, port): """ @@ -398,6 +399,7 @@ class Web: def waitress_custom_shutdown(self): """Shutdown the Waitress server immediately""" # Code borrowed from https://github.com/Pylons/webtest/blob/4b8a3ebf984185ff4fefb31b4d0cf82682e1fcf7/webtest/http.py#L93-L104 + self.waitress.shutdown = True while self.waitress._map: triggers = list(self.waitress._map.values()) for trigger in triggers: |