func RunCommand()

in pkg/util/runcmd.go [30:45]


func RunCommand(cmd string, args ...string) ([]byte, error) {
	execCmd := exec.Command(cmd, args...)
	output, err := execCmd.CombinedOutput()
	if err != nil {
		if err.Error() == errNoChildProcesses {
			if execCmd.ProcessState.Success() {
				// If the process succeeded, this can be ignored, see k/k issue #103753
				return output, nil
			}
			// Get actual error
			err = &exec.ExitError{ProcessState: execCmd.ProcessState}
		}
		return output, fmt.Errorf("%s %s failed: %w; output: %s", cmd, strings.Join(args, " "), err, string(output))
	}
	return output, nil
}