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.
This commit is contained in:
Aniruddha Adak authored and n committed 2026-09-12 01:29:23 +00:00
1 parent 2ad70a2815
commit 21f134056d
1 file changed
+5
+5
View File
@@ -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: