Merge pull request #181 from hashicorp/b-discover-path
Correctly scan the CWD for the nomad executable
This commit is contained in:
commit
2c4f677f07
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue