From 908fdd2d51aa60b0f8cc1220acd7fe8bc382f5b4 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Thu, 23 Mar 2023 01:05:30 +0800 Subject: [PATCH 1/3] Handle SIGBREAK for Windows --- uvicorn/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uvicorn/server.py b/uvicorn/server.py index a451948db..34ca7deb3 100644 --- a/uvicorn/server.py +++ b/uvicorn/server.py @@ -28,6 +28,8 @@ signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. signal.SIGTERM, # Unix signal 15. Sent by `kill `. ) +if sys.platform == "win32": + HANDLED_SIGNALS += (signal.SIGBREAK,) # Windows signal 21. Sent by Ctrl+Break. logger = logging.getLogger("uvicorn.error") From 83f7e2d8a59a1d26faecdb20c1278aaf21bfe05c Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Fri, 24 Mar 2023 17:51:32 +0800 Subject: [PATCH 2/3] Ignore code on other os --- uvicorn/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/server.py b/uvicorn/server.py index 34ca7deb3..3c9f356b6 100644 --- a/uvicorn/server.py +++ b/uvicorn/server.py @@ -28,7 +28,7 @@ signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. signal.SIGTERM, # Unix signal 15. Sent by `kill `. ) -if sys.platform == "win32": +if sys.platform == "win32": # pragma py-linux pragma: py-darwin HANDLED_SIGNALS += (signal.SIGBREAK,) # Windows signal 21. Sent by Ctrl+Break. logger = logging.getLogger("uvicorn.error") From 8adcbdd362de9e7176e3cdc94ba1173e0d86cbfe Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Thu, 13 Apr 2023 20:16:39 +0800 Subject: [PATCH 3/3] Update pragma condition flag --- uvicorn/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/server.py b/uvicorn/server.py index e9aca3777..426fd7d16 100644 --- a/uvicorn/server.py +++ b/uvicorn/server.py @@ -28,7 +28,7 @@ signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. signal.SIGTERM, # Unix signal 15. Sent by `kill `. ) -if sys.platform == "win32": # pragma py-linux pragma: py-darwin +if sys.platform == "win32": # pragma: py-not-win32 HANDLED_SIGNALS += (signal.SIGBREAK,) # Windows signal 21. Sent by Ctrl+Break. logger = logging.getLogger("uvicorn.error")