add defer.

This commit is contained in:
Tejal Desai 2020-08-13 10:47:35 -07:00 committed by GitHub
parent dd4191ad3d
commit 8f1528764f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -71,12 +71,13 @@ func runCommandInExec(config *v1.Config, buildArgs *dockerfile.BuildArgs, cmdRun
continue
}
oldPath := os.Getenv("PATH")
defer os.Setenv("PATH", oldPath)
os.Setenv("PATH", entry[1])
path, err := exec.LookPath(newCommand[0])
if err == nil {
newCommand[0] = path
}
os.Setenv("PATH", oldPath)
}
}