lncli: start signal interceptor in getContext

signal Intercept function needs to be called if the signal shutdown
channel will be listened on.
This commit is contained in:
Elle Mouton committed 2021-03-17 22:44:45 +02:00
1 parent e2690918a0
commit 000516ec4d
2 files changed
+5 -4

No files matched your search

+5
View File
@@ -41,6 +41,11 @@ const (
)
func getContext() context.Context {
if err := signal.Intercept(); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
ctxc, cancel := context.WithCancel(context.Background())
go func() {
<-signal.ShutdownChannel()