Skip to content

Commit

Permalink
Merge pull request #181 from hashicorp/b-discover-path
Browse files Browse the repository at this point in the history
Correctly scan the CWD for the nomad executable
  • Loading branch information
dadgar committed Sep 30, 2015
2 parents 3a3aa18 + ca85df8 commit 2351a97
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions helper/discover/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ func NomadExecutable() (string, error) {
}

// Check the CWD.
bin = filepath.Join(os.Getenv("GOPATH"), "bin", nomadExe)
if _, err := os.Stat(bin); err == nil {
return bin, nil
}

pwd, err := os.Getwd()
if err != nil {
return "", fmt.Errorf("Could not find Nomad executable (%v): %v", err)
Expand All @@ -47,5 +42,11 @@ func NomadExecutable() (string, error) {
return bin, nil
}

// Check CWD/bin
bin = filepath.Join(pwd, "bin", nomadExe)
if _, err := os.Stat(bin); err == nil {
return bin, nil
}

return "", fmt.Errorf("Could not find Nomad executable (%v)", nomadExe)
}

0 comments on commit 2351a97

Please sign in to comment.