diff --git a/pkg/util/exec/exec.go b/pkg/util/exec/exec.go index 2fdef2c41..ae87a9485 100644 --- a/pkg/util/exec/exec.go +++ b/pkg/util/exec/exec.go @@ -199,6 +199,9 @@ func (*CommandExecutor) ExecuteCommandWithOutputFile(command, outfileArg string, // #nosec G204 Rook controls the input to the exec arguments cmd := exec.Command(command, arg...) cmdOut, err := cmd.CombinedOutput() + if err != nil { + cmdOut = []byte(fmt.Sprintf("%s. %s", string(cmdOut), string(err.(*exec.ExitError).Stderr))) + } // if there was anything that went to stdout/stderr then log it, even before we return an error if string(cmdOut) != "" { logger.Debug(string(cmdOut))