0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-02-24 23:57:05 -05:00

sigtrap: Ensure cleanup actions happen before too many things go wrong

This commit is contained in:
Matthew Holt 2018-02-13 13:27:08 -07:00
parent f26447e2fb
commit 4b2e22289d
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -41,14 +41,14 @@ func trapSignalsPosix() {
case syscall.SIGTERM:
log.Println("[INFO] SIGTERM: Shutting down servers then terminating")
exitCode := executeShutdownCallbacks("SIGTERM")
for _, f := range OnProcessExit {
f() // only perform important cleanup actions
}
err := Stop()
if err != nil {
log.Printf("[ERROR] SIGTERM stop: %v", err)
exitCode = 3
}
for _, f := range OnProcessExit {
f() // only perform important cleanup actions
}
os.Exit(exitCode)
case syscall.SIGUSR1: