diff --git a/cmd/install.go b/cmd/install.go index 09321d14..81e1f018 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -266,9 +266,12 @@ Provide the --local-path flag with --merge if a kubeconfig already exists in som return err } - if len(res.StdErr) > 0 { - fmt.Printf("stderr: %q", res.StdErr) + if res.ExitCode != 0 { + if len(res.StdErr) > 0 { + fmt.Printf("stderr: %q", res.StdErr) + } } + if len(res.StdOut) > 0 { fmt.Printf("stdout: %q", res.StdOut) } diff --git a/pkg/operator/exec_operator.go b/pkg/operator/exec_operator.go index cc1b9517..06cbef09 100644 --- a/pkg/operator/exec_operator.go +++ b/pkg/operator/exec_operator.go @@ -21,8 +21,9 @@ func (ex ExecOperator) ExecuteStdio(command string, stream bool) (CommandRes, er } return CommandRes{ - StdErr: []byte(res.Stderr), - StdOut: []byte(res.Stdout), + StdErr: []byte(res.Stderr), + StdOut: []byte(res.Stdout), + ExitCode: res.ExitCode, }, nil } diff --git a/pkg/operator/operator.go b/pkg/operator/operator.go index cc9b38e8..dc056196 100644 --- a/pkg/operator/operator.go +++ b/pkg/operator/operator.go @@ -8,6 +8,7 @@ type CommandOperator interface { // CommandRes contains the STDIO output from running a command type CommandRes struct { - StdOut []byte - StdErr []byte + StdOut []byte + StdErr []byte + ExitCode int }