try not without checking stat first

This commit is contained in:
Mahmood Ali
2019-04-02 19:55:44 -04:00
parent 9adab75ac8
commit d441cdd52f

View File

@@ -549,12 +549,6 @@ func (e *UniversalExecutor) handleStats(ch chan *cstructs.TaskResourceUsage, ctx
// the following locations, in-order: task/local/, task/, based on host $PATH.
// The return path is absolute.
func lookupBin(taskDir string, bin string) (string, error) {
// Check the binary path first
// This handles the case where the job spec sends a fully interpolated path to the binary
if _, err := os.Stat(bin); err == nil {
return bin, nil
}
// Check in the local directory
local := filepath.Join(taskDir, allocdir.TaskLocal, bin)
if _, err := os.Stat(local); err == nil {