From 21f134056d0f8884fa9aa4cf54a4c788efd7ce21 Mon Sep 17 00:00:00 2001 From: Aniruddha Adak Date: Wed, 26 Aug 2026 21:50:26 +0530 Subject: [PATCH] fix(server): register SIGINT handler for graceful shutdown (#7078) ctl.sh start spawns the server from a non-interactive bash background job, which causes the child to inherit SIGINT=SIG_IGN. The Stop server buttonsends SIGINT (os.kill(pid, signal.SIGINT)), which is silently ignored. Register _request_shutdown for SIGINT in addition to SIGTERM so the shutdown button works for ctl.sh-managed daemons. --- server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.py b/server.py index 743ed765..b3f6546f 100644 --- a/server.py +++ b/server.py @@ -720,6 +720,11 @@ def main() -> None: # Not on the main thread (e.g. embedded/test harness); skip handler. logger.debug("Could not install SIGTERM handler", exc_info=True) + try: + signal.signal(signal.SIGINT, _request_shutdown) + except (ValueError, OSError): + logger.debug("Could not install SIGINT handler", exc_info=True) + try: httpd.serve_forever() finally: