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:
1 parent
2ad70a2815
commit
21f134056d
1 file changed
+5
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user