summaryrefslogtreecommitdiffhomepage
path: root/caddy.go
diff options
context:
space:
mode:
Diffstat (limited to 'caddy.go')
-rw-r--r--caddy.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/caddy.go b/caddy.go
index dd2d473a9..628673a73 100644
--- a/caddy.go
+++ b/caddy.go
@@ -77,6 +77,14 @@ var (
mu sync.Mutex
)
+func init() {
+ OnProcessExit = append(OnProcessExit, func() {
+ if PidFile != "" {
+ os.Remove(PidFile)
+ }
+ })
+}
+
// Instance contains the state of servers created as a result of
// calling Start and can be used to access or control those servers.
// It is literally an instance of a server type. Instance values