Skip to content

Commit

Permalink
fix: node executables not running on windows if bash toolchain path (#…
Browse files Browse the repository at this point in the history
…1104)

contains whitespace.

The windows launcher code does currently break if the path to the bash
binary contains a whitespace.

This is common on windows where programs are stored under
`C:\Program Files`.

e.g.

```
:run
C:/Program Files/msys2/usr/bin/bash.exe -c "!run_script!"
```

The path needs to be quoted so that it won't be incorrectly picked up as
two separate commands. Resulting in an
exception like:

```
'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
```
  • Loading branch information
devversion authored and alexeagle committed Sep 6, 2019
1 parent 5e98bda commit c82b43d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/common/windows_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ set RUNFILES_MANIFEST_ONLY=1
call :rlocation "{sh_script}" run_script
for %%a in ("{bash_bin}") do set "bash_bin_dir=%%~dpa"
set PATH=%bash_bin_dir%;%PATH%
{bash_bin} -c "!run_script! %*"
"{bash_bin}" -c "!run_script! %*"
""".format(
bash_bin = ctx.toolchains["@bazel_tools//tools/sh:toolchain_type"].path,
sh_script = _to_manifest_path(ctx, shell_script),
Expand Down

0 comments on commit c82b43d

Please sign in to comment.