cmd/stepd: Fix pid file being spawned even if not specified
This commit is contained in:
parent
666a9b0c77
commit
4a1b78b857
@ -59,11 +59,11 @@ func main () {
|
|||||||
ctx, done := context.WithCancel(context.Background())
|
ctx, done := context.WithCancel(context.Background())
|
||||||
defer done()
|
defer done()
|
||||||
daemon.OnSigint(done)
|
daemon.OnSigint(done)
|
||||||
pidFileAbs, err := filepath.Abs(flagPidFile.Value)
|
if flagPidFile.Value != "" {
|
||||||
if err != nil { log.Fatalln("XXX", err) }
|
pidFileAbs, err := filepath.Abs(flagPidFile.Value)
|
||||||
pidFile := daemon.PidFile(pidFileAbs)
|
if err != nil { log.Fatalln("XXX", err) }
|
||||||
if !pidFile.Empty() {
|
pidFile := daemon.PidFile(pidFileAbs)
|
||||||
err := pidFile.Start()
|
err = pidFile.Start()
|
||||||
if err != nil { log.Println("!!! could not write pid:", err) }
|
if err != nil { log.Println("!!! could not write pid:", err) }
|
||||||
defer func () {
|
defer func () {
|
||||||
err := pidFile.Close()
|
err := pidFile.Close()
|
||||||
@ -111,7 +111,7 @@ func main () {
|
|||||||
Config: config,
|
Config: config,
|
||||||
}
|
}
|
||||||
environment.Providers = providers.All()
|
environment.Providers = providers.All()
|
||||||
err = environment.Init(context.Background())
|
err := environment.Init(context.Background())
|
||||||
if err != nil { log.Fatal(err) }
|
if err != nil { log.Fatal(err) }
|
||||||
|
|
||||||
// set up the HTTP handler
|
// set up the HTTP handler
|
||||||
|
Loading…
Reference in New Issue
Block a user