Skip to content

bazel run: no longer requires Bash for simple case - #8241

Closed
laszlocsomor wants to merge 3 commits into
bazelbuild:masterfrom
laszlocsomor:bashless-bazel-run
Closed

laszlocsomor wants to merge 3 commits into
bazelbuild:masterfrom
laszlocsomor:bashless-bazel-run

Conversation

@laszlocsomor

@laszlocsomor laszlocsomor commented May 6, 2019 •

Copy link
Copy Markdown
Contributor

Windows: add --incompatible_bashless_run_command

This flag enables Bash-less "bazel run" for simple
cases (no --run_under, no --script_path).

When enabled, "bazel run //foo:bin" no longer
requires Bash, and works with
--shell_executable="".

Bash is still required with --run_under="foo"
and with --script_path=<path>.

Fixes #8229
See #8240

@laszlocsomor
laszlocsomor force-pushed the bashless-bazel-run branch from 5a7ae73 to af4aa0d Compare May 6, 2019 09:04
@laszlocsomor laszlocsomor changed the title bazel run: no longer requires Bash for simple case WIP: bazel run: no longer requires Bash for simple case May 6, 2019
This flag enables Bash-less "bazel run" for simple
cases (no `--run_under`, no `--script_path`).

When enabled, "bazel run //foo:bin" no longer
requires Bash, and works with
`--shell_executable=""`.

Bash is still required with --run_under="foo" and
with --script_path=<path>.

Fixes bazelbuild#8229
See bazelbuild#8240

Change-Id: I36b9951674bf8651216178d6b34f28a496e724b9
@laszlocsomor
laszlocsomor force-pushed the bashless-bazel-run branch from af4aa0d to b769f31 Compare May 6, 2019 09:12
Change-Id: I93c26e6d782ed7bb32d59e4ff52329ecd81106e3
@irengrig irengrig added the WIP label May 7, 2019
@laszlocsomor laszlocsomor changed the title WIP: bazel run: no longer requires Bash for simple case bazel run: no longer requires Bash for simple case May 8, 2019
@laszlocsomor
laszlocsomor requested a review from meteorcloudy May 8, 2019 08:38
@laszlocsomor laszlocsomor removed the WIP label May 8, 2019

@meteorcloudy meteorcloudy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

@bazel-io bazel-io closed this in e8af81c May 8, 2019
@laszlocsomor
laszlocsomor deleted the bashless-bazel-run branch May 8, 2019 10:37
laszlocsomor added a commit to laszlocsomor/bazel that referenced this pull request May 10, 2019
To "bazel run" a binary, the RunCommand creates an
ExecRequest and sends it to the Bazel client,
which then fulfills the request.

In PR bazelbuild#8241, RunCommand merged all command line
arguments and added that to the request as a
single argv entry. The client uses the first argv
element as the executable, but if all arguments
are joined into one string then argv0 contains the
whole argument vector as a single string.

Unfortunately the test didn't catch this because
it didn't attempt passing any arguments.

Fixes bazelbuild#8229
See bazelbuild#8240
bazel-io pushed a commit that referenced this pull request May 10, 2019
To "bazel run" a binary, the RunCommand creates an
ExecRequest and sends it to the Bazel client,
which then runs the binary as the client's
subprocess.

In PR #8241, RunCommand merged all command line
arguments and added that to the request as a
single argv entry. The client uses the first argv
element as the executable, but if all arguments
are joined into one string then argv0 contains the
whole argument vector as a single string.

Unfortunately the test didn't catch this because
it didn't attempt passing any arguments.

Fixes #8229
See #8240

Closes #8287.

PiperOrigin-RevId: 247590904
irengrig pushed a commit to irengrig/bazel that referenced this pull request Jun 18, 2019
To "bazel run" a binary, the RunCommand creates an
ExecRequest and sends it to the Bazel client,
which then runs the binary as the client's
subprocess.

In PR bazelbuild#8241, RunCommand merged all command line
arguments and added that to the request as a
single argv entry. The client uses the first argv
element as the executable, but if all arguments
are joined into one string then argv0 contains the
whole argument vector as a single string.

Unfortunately the test didn't catch this because
it didn't attempt passing any arguments.

Fixes bazelbuild#8229
See bazelbuild#8240

Closes bazelbuild#8287.

PiperOrigin-RevId: 247590904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: "bazel run" requires Bash [blocking #4319]

4 participants