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 <code@whatthefox.dev>
This commit is contained in:
Ian Fox
2025-06-02 19:12:45 +02:00
parent b67b9f3af2
commit 91ecdaba4e
+2
View File
@@ -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 {