Skip to content

Commit

Permalink
Merge pull request onionshare#1790 from onionshare/fix-waitress-stop-…
Browse files Browse the repository at this point in the history
…error

Raise error from waitress if not shutdown
  • Loading branch information
mig5 authored Oct 23, 2023
2 parents 9f247ed + b2f0444 commit f880a93
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/onionshare_cli/web/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ def start(self, port):
)
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):
"""
Expand Down Expand Up @@ -398,6 +399,7 @@ def cleanup(self):
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:
Expand Down

0 comments on commit f880a93

Please sign in to comment.