Merge pull request #56401 from porridge/log-actual-rc

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Log actual return code, not the default value.

**What this PR does / why we need it**:

Previously the code would log 127, no matter what, which is quite
useless..

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-12-15 20:08:16 -08:00 committed by GitHub
commit 1433716af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2130,8 +2130,8 @@ func (b kubectlBuilder) Exec() (string, error) {
if err != nil {
var rc int = 127
if ee, ok := err.(*exec.ExitError); ok {
Logf("rc: %d", rc)
rc = int(ee.Sys().(syscall.WaitStatus).ExitStatus())
Logf("rc: %d", rc)
}
return "", uexec.CodeExitError{
Err: fmt.Errorf("error running %v:\nCommand stdout:\n%v\nstderr:\n%v\nerror:\n%v\n", cmd, cmd.Stdout, cmd.Stderr, err),