diff --git a/shutdown.go b/shutdown.go index 1a956d8..1c9cb72 100644 --- a/shutdown.go +++ b/shutdown.go @@ -14,8 +14,12 @@ func ShutdownContext(c context.Context) context.Context { go func() { ch := make(chan os.Signal, 1) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) - <-ch - cancel() + select { + case <-ctx.Done(): + return + case <-ch: + cancel() + } }() return ctx }