bazeliskNpmPath: should check if @bazel/bazelisk binary exists? #370
Closed
Description
I recently had an issue where if I run @bazel/ibazel
using yarn ibazel
(or npn bazel
) it would attempt to locate @bazel/bazelisk
(and fail) even though I did not install @bazel/bazelisk
.
Steps to reproduce
Assuming bazel
is already in PATH
.
- Create an empty directory
- Run
yarn init
- Run
yarn install -D @bazel/ibazel
- Add dummy BUILD and WORKSPACE
- Run
yarn ibazel build //...
Expected result: build succeeds
Actual result:
$ yarn ibazel build //...
yarn run v1.13.0
$ /private/tmp/bazelisk/node_modules/.bin/ibazel build //...
iBazel [2:56AM]: Error getting Bazel info fork/exec /private/tmp/bazelisk/node_modules/@bazel/bazelisk/bazelisk-darwin_amd64: no such file or directory
iBazel [2:56AM]: Querying for files to watch...
iBazel [2:56AM]: Bazel query failed: fork/exec /private/tmp/bazelisk/node_modules/@bazel/bazelisk/bazelisk-darwin_amd64: no such file or directory
iBazel [2:56AM]: Bazel query failed: fork/exec /private/tmp/bazelisk/node_modules/@bazel/bazelisk/bazelisk-darwin_amd64: no such file or directory
iBazel [2:56AM]: Building //...
iBazel [2:56AM]: Build error: fork/exec /private/tmp/bazelisk/node_modules/@bazel/bazelisk/bazelisk-darwin_amd64: no such file or directory
iBazel [2:56AM]: Error reading config: open .bazel_fix_commands.json: no such file or directory
iBazel [2:56AM]: Use default regex
^C
Looking at
Line 72 in d7c0cc4
node_modules/@bazel/bazelisk/bazelizk-darwin_amd64
but does not check if the binary actually exists.
So the fix should be simply adding a os.Stat
check?
bazel version:
Build label: 2.2.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Mar 3 09:28:15 2020 (1583227695)
Build timestamp: 1583227695
Build timestamp as int: 1583227695
iBazel - Version v0.12.3
Metadata
Assignees
Labels
No labels