From 581a3cf5f868cdb6e028f6dd7687de2e3377bcd7 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Mon, 12 Feb 2024 21:41:03 -0800 Subject: [PATCH] Handle k8s sigterm (#50) --- scli.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scli.go b/scli.go index 52c238b..e750bcb 100644 --- a/scli.go +++ b/scli.go @@ -21,6 +21,7 @@ import ( "os/signal" "runtime" "strings" + "syscall" "time" "fortio.org/cli" @@ -130,7 +131,7 @@ func ServerMain() bool { func UntilInterrupted() { // listen for interrupt signal c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) // Block until a signal is received. <-c log.Warnf("Interrupt received.")