Skip to content

Commit

Permalink
an alternative order
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali committed Apr 3, 2019
1 parent d441cdd commit 244544b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/shared/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,14 @@ func lookupBin(taskDir string, bin string) (string, error) {
return root, nil
}

// when checking host paths, check with Stat first if path is absolute
// as exec.LookPath only considers files already marked as executable
// and only consider this for absolute paths to avoid depending on
// current directory of nomad which may cause unexpected behavior
if _, err := os.Stat(bin); err == nil && filepath.IsAbs(bin) {
return bin, nil
}

// Check the $PATH
if host, err := exec.LookPath(bin); err == nil {
return host, nil
Expand Down

0 comments on commit 244544b

Please sign in to comment.