John
John

Reputation: 30175

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.

Upvotes: 2

Views: 2024

Answers (1)

Brian Silverman
Brian Silverman

Reputation: 3838

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.

Upvotes: 2

Related Questions