Skip to content

Commit

Permalink
Handle empty argument in repository_ctx.which()
Browse files Browse the repository at this point in the history
This PR handles empty program name in repository_ctx.which() to fix bazelbuild#12216

Closes bazelbuild#12436.

PiperOrigin-RevId: 343116909
  • Loading branch information
mai93 authored and copybara-github committed Nov 18, 2020
1 parent 9b5df56 commit ddcf5f7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,10 @@ public StarlarkPath which(String program, StarlarkThread thread) throws EvalExce
env.getListener().post(w);
if (program.contains("/") || program.contains("\\")) {
throw Starlark.errorf(
"Program argument of which() may not contains a / or a \\ ('%s' given)", program);
"Program argument of which() may not contain a / or a \\ ('%s' given)", program);
}
if (program.length() == 0) {
throw Starlark.errorf("Program argument of which() may not be empty");
}
try {
StarlarkPath commandPath = findCommandOnPath(program);
Expand Down

0 comments on commit ddcf5f7

Please sign in to comment.