fix: Handle KeyboardInterrupt gracefully in server.py
This commit is contained in:
@@ -22,4 +22,8 @@ class SystemInfoHandler(http.server.SimpleHTTPRequestHandler):
|
|||||||
|
|
||||||
with socketserver.TCPServer(('', PORT), SystemInfoHandler) as httpd:
|
with socketserver.TCPServer(('', PORT), SystemInfoHandler) as httpd:
|
||||||
print("serving at port", PORT)
|
print("serving at port", PORT)
|
||||||
|
try:
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("\nShutting down server.")
|
||||||
|
httpd.shutdown()
|
||||||
|
|||||||
Reference in New Issue
Block a user