Sfoglia il codice sorgente

[CLI] `qmk docs` graceful shutdown on Ctrl+C (#6989)

fauxpark 5 anni fa
parent
commit
076d8babbb
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      lib/python/qmk/cli/docs.py

+ 6 - 1
lib/python/qmk/cli/docs.py

@@ -19,4 +19,9 @@ def docs(cli):
         cli.log.info("Serving QMK docs at http://localhost:%d/", cli.config.docs.port)
         cli.log.info("Press Control+C to exit.")
 
-        httpd.serve_forever()
+        try:
+            httpd.serve_forever()
+        except KeyboardInterrupt:
+            cli.log.info("Stopping HTTP server...")
+        finally:
+            httpd.shutdown()