-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starlark, run_shell: not passing arguments to script #6391
Comments
In fact the Bash invocation seems wrong, because I can repro this outside of Bazel: /tmp/args.sh:
The unwanted behavior:
Adding quotes solves the problem:
And to explain what's the space after "args=(", let's change the
|
FYI: as a workaround, I can abstain from using
Output:
|
See bazelbuild#6391 Change-Id: Ia38669a9f3747e76853402775678c992723ccd72
You're expected to use '$@' as part of the command: $ /bin/bash -c 'echo $@' '' arg1 arg2 arg3 arg1 arg2 arg3 So I imagine this will fix the issue: ctx.actions.run_shell(
tools = [script1],
outputs = [script2],
command = script1.path + " $@",
arguments = [script2.path, "a", "b"],
) If your command is just |
By whom?
No, that won't work on Windows. |
Well, if you want to use the arguments, you should use |
@laurentlb could you add a priority to this issue, please? |
This issue I just filed is superficially related: #7122. But concerns differences in behaviour between Windows and Linux. |
Closing this issue, because the behavior was intended. |
Description of the problem / feature request:
When using
ctx.actions.run_shell
with a shell script's path forcommand
, thearguments
are not passed to the script.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I have a simple Starlark rule that write a script (script1), executes it using run_shell, and expects it to write another script (script2).
BUILD file:
args_test.bzl:
Bazel output:
I expected to see "a" and "b" in the "DEBUG" line, but apparently no args are passed.
What operating system are you running Bazel on?
Debian GNU/Linux rodete
What's the output of
bazel info release
?release 0.17.2
The text was updated successfully, but these errors were encountered: