Skip to content

Commit

Permalink
remove PID from logging to avoid race on process exit (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross authored May 30, 2017
1 parent 3372754 commit c45436a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit c45436a

Please sign in to comment.