Merge pull request #181 from hashicorp/b-discover-path

Correctly scan the CWD for the nomad executable
This commit is contained in:
Alex Dadgar 2015-09-30 14:31:32 -07:00
commit 2c4f677f07
1 changed files with 6 additions and 5 deletions

View File

@ -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)
@ -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)
}