From 7da8bf35f033e793b990fcaeb167944c00a12822 Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Thu, 22 Aug 2024 10:54:13 +0200 Subject: [PATCH] always kill self on ctrl+c --- py4web/core.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/py4web/core.py b/py4web/core.py index ca15f1a4..898bf4a7 100644 --- a/py4web/core.py +++ b/py4web/core.py @@ -1717,12 +1717,10 @@ def start_server(kwargs): server_config["server"] = "gunicorn" # Catch interrupts like Ctrl-C if needed - def stop_then_kill(sig, grame): - os.kill(os.getpid(), signal.SIGTERM) - time.sleep(2) + def kill_all(sig, grame): os.kill(os.getpid(), signal.SIGKILL) - signal.signal(signal.SIGINT, stop_then_kill) + signal.signal(signal.SIGINT, kill_all) adapter = server_adapters.available.get(server_config["server"]) params["server"] = adapter or server_config["server"]