We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c90b807 commit 2a96e6bCopy full SHA for 2a96e6b
signals/signals.go
@@ -15,6 +15,7 @@ package signals
15
16
import (
17
"context"
18
+ "fmt"
19
"os"
20
"os/signal"
21
@@ -37,14 +38,14 @@ func Context() context.Context {
37
38
// panics when called twice
39
close(onlyOneSignalHandler)
40
- ctx, cancel := context.WithCancel(context.Background())
41
+ ctx, cancel := context.WithCancelCause(context.Background())
42
sigCh := make(chan os.Signal, 1)
43
signal.Notify(sigCh, shutdownSignals...)
44
45
go func() {
46
sig := <-sigCh
47
log.Infof(`Received signal '%s'; beginning shutdown`, sig)
- cancel()
48
+ cancel(fmt.Errorf("cancelling context, received signal %s", sig))
49
sig = <-sigCh
50
log.Fatalf(
51
`Received signal '%s' during shutdown; exiting immediately`,
0 commit comments