add defer.

This commit is contained in:
Tejal Desai
2020-08-13 10:47:35 -07:00
committed by GitHub
parent dd4191ad3d
commit 8f1528764f
+2 -1
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)
}
}