瀏覽代碼

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

fauxpark 5 年之前
父節點
當前提交
076d8babbb
共有 1 個文件被更改,包括 6 次插入1 次删除
  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()