cmd/stepd: Fix pid file being spawned even if not specified

This commit is contained in:
Sasha Koshka 2024-12-10 02:58:50 -05:00
parent 666a9b0c77
commit 4a1b78b857

View File

@ -59,11 +59,11 @@ func main () {
ctx, done := context.WithCancel(context.Background())
defer done()
daemon.OnSigint(done)
if flagPidFile.Value != "" {
pidFileAbs, err := filepath.Abs(flagPidFile.Value)
if err != nil { log.Fatalln("XXX", err) }
pidFile := daemon.PidFile(pidFileAbs)
if !pidFile.Empty() {
err := pidFile.Start()
err = pidFile.Start()
if err != nil { log.Println("!!! could not write pid:", err) }
defer func () {
err := pidFile.Close()
@ -111,7 +111,7 @@ func main () {
Config: config,
}
environment.Providers = providers.All()
err = environment.Init(context.Background())
err := environment.Init(context.Background())
if err != nil { log.Fatal(err) }
// set up the HTTP handler