mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
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:
parent
e2690918a0
commit
000516ec4d
@ -436,10 +436,6 @@ func openChannelPsbt(rpcCtx context.Context, ctx *cli.Context,
|
||||
return fmt.Errorf("opening stream to server failed: %v", err)
|
||||
}
|
||||
|
||||
if err := signal.Intercept(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// We also need to spawn a goroutine that reads from the server. This
|
||||
// will copy the messages to the channel as long as they come in or add
|
||||
// exactly one error to the error stream and then bail out.
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user