Skip to content

Commit 6c6bbdd

Browse files
committed
signal: initialize interceptor explictly
1 parent 76c2b2c commit 6c6bbdd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lnd.go

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ type rpcListeners func() ([]net.Listener, func(), []grpc.ServerOption, error)
116116
// created in the top-level scope of a main method aren't executed if os.Exit()
117117
// is called.
118118
func Main(lisCfg ListenerCfg) error {
119+
// Hook interceptor for os signals.
120+
signal.Intercept()
121+
119122
// Load the configuration, and parse any command line options. This
120123
// function will also set up logging properly.
121124
loadedConfig, err := loadConfig()

signal/signal.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var (
2626
shutdownChannel = make(chan struct{})
2727
)
2828

29-
func init() {
29+
// Intercept starts the interception of interrupt signals.
30+
func Intercept() {
3031
signalsToCatch := []os.Signal{
3132
os.Interrupt,
3233
os.Kill,

0 commit comments

Comments
 (0)