From 875f6c6a4d11407de0d46dc04f058eb8f6a244dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=BChn?= Date: Sat, 20 Jul 2024 09:41:01 +0200 Subject: [PATCH] Suppress `KeyboardInterrupt` from CLI and programmatic usage (#2384) Co-authored-by: Marcelo Trylesinski --- uvicorn/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uvicorn/main.py b/uvicorn/main.py index 41e9ec84e..6fab04b5f 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -575,6 +575,8 @@ def run( Multiprocess(config, target=server.run, sockets=[sock]).run() else: server.run() + except KeyboardInterrupt: + pass finally: if config.uds and os.path.exists(config.uds): os.remove(config.uds) # pragma: py-win32