diff --git a/cmd/lncli/cmd_open_channel.go b/cmd/lncli/cmd_open_channel.go index 15b0db802..c3471ae1c 100644 --- a/cmd/lncli/cmd_open_channel.go +++ b/cmd/lncli/cmd_open_channel.go @@ -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. diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 44450c136..5e6e3be7b 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -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()