atexit: prevent Run from being called on nil signal

This commit is contained in:
Fabian Möller 2018-05-12 18:59:25 +02:00
parent d022c81d99
commit 6791cf7d7f

View File

@ -29,7 +29,7 @@ func Register(fn func()) {
signal.Notify(exitChan, os.Interrupt) // syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT
go func() {
sig, closed := <-exitChan
if closed {
if closed || sig == nil {
return
}
fs.Infof(nil, "Signal received: %s", sig)