From 917459611d547cef580dcd4b2172560d3768282d Mon Sep 17 00:00:00 2001 From: trybefore <46175007+trybefore@users.noreply.github.com> Date: Tue, 22 Jun 2021 22:42:08 +0200 Subject: [PATCH] bot: Wait catch SIGTERM (#233) Signed-off-by: Daniel Boman --- bot/ctx.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/ctx.go b/bot/ctx.go index 379b06f..c167da8 100644 --- a/bot/ctx.go +++ b/bot/ctx.go @@ -8,6 +8,7 @@ import ( "os/signal" "strings" "sync" + "syscall" "time" "github.com/pkg/errors" @@ -267,7 +268,7 @@ func Run(token string, cmd interface{}, opts func(*Context) error) { // WaitForInterrupt blocks until SIGINT. func WaitForInterrupt() { sigs := make(chan os.Signal, 1) - signal.Notify(sigs, os.Interrupt) + signal.Notify(sigs, os.Interrupt, syscall.SIGTERM) <-sigs }