From 2517b2daa1b7456f64d625262cfef7d576df48b5 Mon Sep 17 00:00:00 2001 From: object-Object Date: Mon, 9 Oct 2023 20:35:13 -0400 Subject: [PATCH] Improve watch mode behaviour --- doc/nodemon.json | 6 +++++- doc/src/hexdoc/cli/main.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/nodemon.json b/doc/nodemon.json index 102934e7..6cdc606a 100644 --- a/doc/nodemon.json +++ b/doc/nodemon.json @@ -1,5 +1,9 @@ { - "watch": ["doc/src/hexdoc/_templates", "doc/properties.toml"], + "watch": [ + "doc/src/hexdoc/_templates", + "doc/properties.toml", + "Common/src/main/resources/assets/hexcasting/lang" + ], "ignore": ["**/generated/**"], "ext": "jinja,html,css,js,toml,json,json5", "exec": "hexdoc serve doc/properties.toml --src _site/src/docs --dst _site/dst/docs --lang en_us --allow-missing --release" diff --git a/doc/src/hexdoc/cli/main.py b/doc/src/hexdoc/cli/main.py index d9502507..bfd68966 100644 --- a/doc/src/hexdoc/cli/main.py +++ b/doc/src/hexdoc/cli/main.py @@ -202,7 +202,12 @@ def serve( f"Serving web book at http://localhost:{port}{book_url} (press ctrl+c to exit)\n" ) with HTTPServer(("", port), SimpleHTTPRequestHandler) as httpd: - httpd.serve_forever() + # ignore KeyboardInterrupt to stop Typer from printing "Aborted." + # because it keeps printing after nodemon exits and breaking the output + try: + httpd.serve_forever() + except KeyboardInterrupt: + pass if __name__ == "__main__":