From 91ecdaba4ea581737421c57efce2c9d4dd47a380 Mon Sep 17 00:00:00 2001 From: Ian Fox Date: Tue, 27 May 2025 14:35:36 +0200 Subject: [PATCH] Make a second sigint terminate immediately Right now, sending a sigint will start a graceful shutdown, which can take quite a while. By calling stop() in the signal handler it unregisters the handler so that a subsequent sigint received during a graceful shutdown will kill the process immediately. Signed-off-by: Ian Fox --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 068dd218..5d0b553c 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,8 @@ func main() { <-ctx.Done() // Perform cleanup or graceful shutdown here logger.L().StopError("Received interrupt signal, exiting...") + // Clear the signal handler so that a second interrupt signal shuts down immediately + stop() }() if err := cmd.Execute(ctx); err != nil {