From c45436a725458c4ead0c6ec1ac5a06b7e77d06e5 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Tue, 30 May 2017 10:55:54 -0400 Subject: [PATCH] remove PID from logging to avoid race on process exit (#352) --- commands/commands.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/commands/commands.go b/commands/commands.go index 84e8e418..78eca1de 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -171,7 +171,7 @@ func (c *Command) setUpCmd() { func (c *Command) Kill() error { log.Debugf("%s.kill", c.Name) if c.Cmd != nil && c.Cmd.Process != nil { - log.Warnf("killing command at pid: %d", c.Cmd.Process.Pid) + log.Warnf("killing command for %s", c.Name) return c.Cmd.Process.Kill() } return nil @@ -180,7 +180,6 @@ func (c *Command) Kill() error { func (c *Command) waitForTimeout() error { quit := make(chan int) - cmd := c.Cmd // for commands that don't have a timeout we just block forever; // this is required for backwards compat. @@ -212,7 +211,7 @@ func (c *Command) waitForTimeout() error { // we'll deadlock defer func() { quit <- 0 }() } - log.Debugf("%s.run waiting for PID %d: ", c.Name, cmd.Process.Pid) + log.Debugf("%s.run waiting", c.Name) defer reapChildren(c.Cmd.SysProcAttr.Pgid) err := c.Cmd.Wait()