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())
 | 
			
		||||
	defer done()
 | 
			
		||||
	daemon.OnSigint(done)
 | 
			
		||||
	pidFileAbs, err := filepath.Abs(flagPidFile.Value)
 | 
			
		||||
	if err != nil { log.Fatalln("XXX", err) }
 | 
			
		||||
	pidFile := daemon.PidFile(pidFileAbs)
 | 
			
		||||
	if !pidFile.Empty() {
 | 
			
		||||
		err := pidFile.Start()
 | 
			
		||||
	if flagPidFile.Value != "" {
 | 
			
		||||
		pidFileAbs, err := filepath.Abs(flagPidFile.Value)
 | 
			
		||||
		if err != nil { log.Fatalln("XXX", err) }
 | 
			
		||||
		pidFile := daemon.PidFile(pidFileAbs)
 | 
			
		||||
		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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user