Skip to content

Commit

Permalink
Fix error message compare
Browse files Browse the repository at this point in the history
As explained here: mitchellh#18

The exec.ErrNotFound error is returned, but this error is wrapped by
exec.Error() so the returned error will never be exec.ErrNotFound.
  • Loading branch information
ethanmick committed Jan 24, 2018
1 parent b8bc1bf commit 9dc1290
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion homedir.go
Expand Up @@ -88,7 +88,7 @@ func dirUnix() (string, error) {
cmd.Stdout = &stdout
if err := cmd.Run(); err != nil {
// If the error is ErrNotFound, we ignore it. Otherwise, return it.
if err != exec.ErrNotFound {
if strings.HasSufix(err.Error(), err.ErrNotFound.Error()) {
return "", err
}
} else {
Expand Down

0 comments on commit 9dc1290

Please sign in to comment.