Merge pull request #432 from tidwall/sighup-fix

Ignore SIGHUP signals
This commit is contained in:
Josh Baker 2019-03-12 14:47:42 -07:00 committed by GitHub
commit 394850e71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 16 deletions

View File

@ -291,7 +291,10 @@ Developer Options:
signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
go func() { go func() {
s := <-c for s := range c {
if s == syscall.SIGHUP {
continue
}
log.Warnf("signal: %v", s) log.Warnf("signal: %v", s)
if pidfile != "" { if pidfile != "" {
cleanup() cleanup()
@ -299,8 +302,6 @@ Developer Options:
switch { switch {
default: default:
os.Exit(-1) os.Exit(-1)
case s == syscall.SIGHUP:
os.Exit(1)
case s == syscall.SIGINT: case s == syscall.SIGINT:
os.Exit(2) os.Exit(2)
case s == syscall.SIGQUIT: case s == syscall.SIGQUIT:
@ -308,6 +309,7 @@ Developer Options:
case s == syscall.SIGTERM: case s == syscall.SIGTERM:
os.Exit(0xf) os.Exit(0xf)
} }
}
}() }()
// _____ _ _ ___ ___ // _____ _ _ ___ ___