mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
lnd: only print shutdown message if logs are initialized
In this commit, we fix a slight bug recently introduced by the addition of the new signal package. As we now use a regular defer for many actions, it may be possible that the logs aren't yet initialized (for example, lnd -h), which can cause a panic if the shutdown procedure goes to log before the logs have been initialized.
This commit is contained in:
parent
c045defd0f
commit
076fc71261
6
lnd.go
6
lnd.go
@ -93,7 +93,11 @@ var (
|
|||||||
// defers created in the top-level scope of a main method aren't executed if
|
// defers created in the top-level scope of a main method aren't executed if
|
||||||
// os.Exit() is called.
|
// os.Exit() is called.
|
||||||
func lndMain() error {
|
func lndMain() error {
|
||||||
defer ltndLog.Info("Shutdown complete")
|
defer func() {
|
||||||
|
if logRotatorPipe != nil {
|
||||||
|
ltndLog.Info("Shutdown complete")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// Load the configuration, and parse any command line options. This
|
// Load the configuration, and parse any command line options. This
|
||||||
// function will also set up logging properly.
|
// function will also set up logging properly.
|
||||||
|
Loading…
Reference in New Issue
Block a user