diff --git a/node_exporter_test.go b/node_exporter_test.go index a1a214c9..5a9599ec 100644 --- a/node_exporter_test.go +++ b/node_exporter_test.go @@ -129,14 +129,9 @@ func runCommandAndTests(cmd *exec.Cmd, address string, fn func(pid int) error) e errc <- fn(pid) }(cmd.Process.Pid) - select { - case err := <-errc: - if cmd.Process != nil { - cmd.Process.Kill() - } - if err != nil { - return err - } + err := <-errc + if cmd.Process != nil { + cmd.Process.Kill() } - return nil + return err }