From 7a927b85c8ed9fd0236d0e7b38a8969f450dff50 Mon Sep 17 00:00:00 2001 From: Dawid Rusnak Date: Mon, 12 Feb 2024 17:07:12 +0100 Subject: [PATCH] fix: kill application when on 2nd termination signal provided (#5002) --- cmd/api-server/main.go | 4 ++++ cmd/kubectl-testkube/commands/root.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cmd/api-server/main.go b/cmd/api-server/main.go index d894bb09014..efedda6ad1e 100644 --- a/cmd/api-server/main.go +++ b/cmd/api-server/main.go @@ -150,6 +150,10 @@ func main() { case <-ctx.Done(): return nil case sig := <-stopSignal: + go func() { + <-stopSignal + os.Exit(137) + }() // Returning an error cancels the errgroup. return errors.Errorf("received signal: %v", sig) } diff --git a/cmd/kubectl-testkube/commands/root.go b/cmd/kubectl-testkube/commands/root.go index 6dcf94c328a..5c5468d0055 100644 --- a/cmd/kubectl-testkube/commands/root.go +++ b/cmd/kubectl-testkube/commands/root.go @@ -180,6 +180,10 @@ func Execute() { case <-ctx.Done(): return nil case sig := <-stopSignal: + go func() { + <-stopSignal + os.Exit(137) + }() return errors.Errorf("received signal: %v", sig) } })