internal: add signal handler for SIGTERM

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-05-08 23:05:47 +02:00
parent cf5771dad3
commit 9e1a518689
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"math/rand"
"os"
"os/signal"
"syscall"
"time"
"github.com/getsentry/sentry-go"
@ -13,6 +14,8 @@ func Init() chan os.Signal {
rand.Seed(time.Now().UnixNano())
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
signal.Notify(interrupt, syscall.SIGINT)
signal.Notify(interrupt, syscall.SIGTERM)
return interrupt
}