1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-02-10 13:33:14 +00:00

bot: Wait catch SIGTERM (#233)

Signed-off-by: Daniel Boman <daniel.boman@pm.me>
This commit is contained in:
trybefore 2021-06-22 22:42:08 +02:00 committed by diamondburned
parent 1b12057e51
commit 917459611d

View file

@ -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
}