From 99914d22043f707f3f69bb5ee509d3353d75e943 Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Mon, 14 Oct 2019 12:07:36 -0400 Subject: [PATCH] Move certmagic import out of caddy package (#2807) --- caddy/caddymain/run.go | 1 + sigtrap.go | 3 --- sigtrap_posix.go | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/caddy/caddymain/run.go b/caddy/caddymain/run.go index 369c7a9b4..33151003c 100644 --- a/caddy/caddymain/run.go +++ b/caddy/caddymain/run.go @@ -83,6 +83,7 @@ func Run() { caddy.AppName = appName caddy.AppVersion = module.Version + caddy.OnProcessExit = append(caddy.OnProcessExit, certmagic.CleanUpOwnLocks) certmagic.UserAgent = appName + "/" + cleanModVersion // Set up process log before anything bad happens diff --git a/sigtrap.go b/sigtrap.go index 7570729d4..236585ea3 100644 --- a/sigtrap.go +++ b/sigtrap.go @@ -21,7 +21,6 @@ import ( "sync" "github.com/caddyserver/caddy/telemetry" - "github.com/mholt/certmagic" ) // TrapSignals create signal handlers for all applicable signals for this @@ -50,7 +49,6 @@ func trapSignalsCrossPlatform() { for _, f := range OnProcessExit { f() // important cleanup actions only } - certmagic.CleanUpOwnLocks() os.Exit(2) } @@ -65,7 +63,6 @@ func trapSignalsCrossPlatform() { } go func() { - certmagic.CleanUpOwnLocks() os.Exit(executeShutdownCallbacks("SIGINT")) }() } diff --git a/sigtrap_posix.go b/sigtrap_posix.go index f19f05c17..607861846 100644 --- a/sigtrap_posix.go +++ b/sigtrap_posix.go @@ -23,7 +23,6 @@ import ( "syscall" "github.com/caddyserver/caddy/telemetry" - "github.com/mholt/certmagic" ) // trapSignalsPosix captures POSIX-only signals. @@ -39,7 +38,6 @@ func trapSignalsPosix() { for _, f := range OnProcessExit { f() // only perform important cleanup actions } - certmagic.CleanUpOwnLocks() os.Exit(0) case syscall.SIGTERM: @@ -57,7 +55,6 @@ func trapSignalsPosix() { telemetry.AppendUnique("sigtrap", "SIGTERM") go telemetry.StopEmitting() // won't finish in time, but that's OK - just don't block - certmagic.CleanUpOwnLocks() os.Exit(exitCode) case syscall.SIGUSR1: