Skip to content

Commit

Permalink
fix: _which_unchecked: don't watch PATH if binary exists.
Browse files Browse the repository at this point in the history
Fixes #2551.
  • Loading branch information
Ubehebe committed Jan 8, 2025
1 parent 4e95a60 commit ee46291
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/private/repo_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def _which_checked(mrctx, binary_name):
def _which_unchecked(mrctx, binary_name):
"""Tests to see if a binary exists.
This is also watch the `PATH` environment variable.
Watches the `PATH` environment variable if the binary doesn't exist.
Args:
binary_name: name of the binary to find.
Expand All @@ -268,12 +268,12 @@ def _which_unchecked(mrctx, binary_name):
* `describe_failure`: `Callable | None`; takes no args. If the
binary couldn't be found, provides a detailed error description.
"""
path = _getenv(mrctx, "PATH", "")
binary = mrctx.which(binary_name)
if binary:
_watch(mrctx, binary)
describe_failure = None
else:
path = _getenv(mrctx, "PATH", "")
describe_failure = lambda: _which_describe_failure(binary_name, path)

return struct(
Expand Down

0 comments on commit ee46291

Please sign in to comment.