From 297a40ac524fc95dadd9d547586629abc4c373bc Mon Sep 17 00:00:00 2001 From: Georgios Tzourmpakis Date: Tue, 11 Aug 2020 14:57:52 +0300 Subject: [PATCH] Also check if `tools/bazel` is a directory (#148) If `tools/bazel` is a directory, the `maybeDelegateToWrapper` function tries to execute it, which results in a permission denied error. This commit prevents that by checking if `tools/bazel` is a directory and ignores it. --- bazelisk.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazelisk.go b/bazelisk.go index 054ec09d..04da0d7d 100644 --- a/bazelisk.go +++ b/bazelisk.go @@ -632,7 +632,7 @@ func maybeDelegateToWrapper(bazel string) string { root := findWorkspaceRoot(wd) wrapper := filepath.Join(root, wrapperPath) - if stat, err := os.Stat(wrapper); err != nil || stat.Mode().Perm()&0001 == 0 { + if stat, err := os.Stat(wrapper); err != nil || stat.IsDir() || stat.Mode().Perm()&0001 == 0 { return bazel }