aboutsummaryrefslogtreecommitdiffhomepage
path: root/sigtrap.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2020-06-03 07:31:31 -0600
committerMatthew Holt <[email protected]>2020-06-03 07:31:31 -0600
commit83551edf3e050b5dd094fc1cff20a3f78c4d621f (patch)
tree92c2931b876d6f9922b64fb640437b7d8c539955 /sigtrap.go
parente18c37306448c5604bb50618c19d7e247fb8805f (diff)
downloadcaddy-83551edf3e050b5dd094fc1cff20a3f78c4d621f.tar.gz
caddy-83551edf3e050b5dd094fc1cff20a3f78c4d621f.zip
cmd: Only stop admin server on signal if it exists (fix #3470)
Diffstat (limited to 'sigtrap.go')
-rw-r--r--sigtrap.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/sigtrap.go b/sigtrap.go
index 08f03aa7f..4ad94c15e 100644
--- a/sigtrap.go
+++ b/sigtrap.go
@@ -69,12 +69,14 @@ func gracefulStop(sigName string) {
exitCode = ExitCodeFailedQuit
}
- err = stopAdminServer(adminServer)
- if err != nil {
- Log().Error("stopping admin endpoint",
- zap.String("signal", sigName),
- zap.Error(err))
- exitCode = ExitCodeFailedQuit
+ if adminServer != nil {
+ err = stopAdminServer(adminServer)
+ if err != nil {
+ Log().Error("stopping admin endpoint",
+ zap.String("signal", sigName),
+ zap.Error(err))
+ exitCode = ExitCodeFailedQuit
+ }
}
}