From 076d8babbbd762f9a316a26144d966238b9b71cc Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 12 Oct 2019 15:41:58 +1100 Subject: [PATCH] [CLI] `qmk docs` graceful shutdown on Ctrl+C (#6989) --- lib/python/qmk/cli/docs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/python/qmk/cli/docs.py b/lib/python/qmk/cli/docs.py index a0888ec3889..b4198913966 100644 --- a/lib/python/qmk/cli/docs.py +++ b/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()