diff --git a/command/agent/exec/exec.go b/command/agent/exec/exec.go index aac454d33a..b22e5eb930 100644 --- a/command/agent/exec/exec.go +++ b/command/agent/exec/exec.go @@ -320,8 +320,11 @@ func (s *Server) restartChildProcess(newEnvVars []string) error { // race condition with ExitCh not being initialized. go func() { select { - case exitCode := <-proc.ExitCh(): - s.childProcessExitCh <- exitCode + case exitCode, ok := <-proc.ExitCh(): + // ignore ExitCh channel closures caused by our restarts + if ok { + s.childProcessExitCh <- exitCode + } } }()