'How do I see the command line that `bazel run` executes?
How do I get the commands executed by Bazel answers a similar question for bazel build, and --subcommands works well for that. But --subcommands does not show the command that's executed for bazel run.
Solution 1:[1]
It's just running the executable built by the target you give it, plus anything else that isn't a bazel flag. Determining what's a bazel flag follows common semantics: anything that doesn't start with - anywhere, and anything at all after --. Some examples:
bazel run //foo:bar runs bar.
bazel run --subcommands //foo:bar and bazel run //foo:bar --subcommands are both just running bar. There are no flags after -- because there is no --.
bazel run //foo:bar xyz runs bar xyz, because xyz doesn't start with -. bazel run //foo:bar -- xyz also does the same thing
bazel run //foo:bar -- --subcommands runs bar --subcommands, without bazel interpreting --subcommands.
You can also use --script_path to output a shell script with the full command and environment setup written out.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Brian Silverman |
