aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'internal/supervisor/supervisor.go')
-rw-r--r--internal/supervisor/supervisor.go24+3 −21
1 files changed, 3 insertions, 21 deletions
diff --git a/internal/supervisor/supervisor.go b/internal/supervisor/supervisor.go
index dcacaa1..202644f 100644
--- a/internal/supervisor/supervisor.go
+++ b/internal/supervisor/supervisor.go
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: 2026 Nikolay Govorov
+// Copyright (c) 2026 Nikolay Govorov
// SPDX-License-Identifier: AGPL-3.0-or-later
// Package supervisor provides a platform-agnostic interface for process
@@ -9,7 +9,6 @@ package supervisor
import (
"context"
- "net"
"os/signal"
"syscall"
)
@@ -30,25 +29,12 @@ type Supervisor interface {
// WaitForStop blocks until the supervisor or OS requests shutdown.
WaitForStop(ctx context.Context) context.Context
-
- // ActivationListeners returns named listeners passed by the service
- // manager (e.g. systemd socket activation). Returns nil when the
- // platform does not support listener inheritance.
- ActivationListeners() (map[string][]net.Listener, error)
-}
-
-var detectors []func() Supervisor
-
-func register(fn func() Supervisor) {
- detectors = append(detectors, fn)
}
// Detect returns a Supervisor for the current platform.
func Detect() Supervisor {
- for _, fn := range detectors {
- if s := fn(); s != nil {
- return s
- }
+ if detectSystemd() {
+ return &systemd{}
}
return &noop{}
}
@@ -66,7 +52,3 @@ func (*noop) WaitForStop(ctx context.Context) context.Context {
_ = stop
return ctx
}
-
-func (*noop) ActivationListeners() (map[string][]net.Listener, error) {
- return nil, nil
-}