From 01112c9a4f9971ddcce7eb23d392d6372a3a3ac6 Mon Sep 17 00:00:00 2001 From: tidwall Date: Tue, 12 Mar 2019 08:40:27 -0700 Subject: [PATCH] Ignore SIGHUP signals --- cmd/tile38-server/main.go | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/cmd/tile38-server/main.go b/cmd/tile38-server/main.go index b77783c6..e8e7a232 100644 --- a/cmd/tile38-server/main.go +++ b/cmd/tile38-server/main.go @@ -291,22 +291,24 @@ Developer Options: signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) go func() { - s := <-c - log.Warnf("signal: %v", s) - if pidfile != "" { - cleanup() - } - switch { - default: - os.Exit(-1) - case s == syscall.SIGHUP: - os.Exit(1) - case s == syscall.SIGINT: - os.Exit(2) - case s == syscall.SIGQUIT: - os.Exit(3) - case s == syscall.SIGTERM: - os.Exit(0xf) + for s := range c { + if s == syscall.SIGHUP { + continue + } + log.Warnf("signal: %v", s) + if pidfile != "" { + cleanup() + } + switch { + default: + os.Exit(-1) + case s == syscall.SIGINT: + os.Exit(2) + case s == syscall.SIGQUIT: + os.Exit(3) + case s == syscall.SIGTERM: + os.Exit(0xf) + } } }()