bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Use backslashes in executable paths when remotely executing on Windows

Open fmeum opened this issue 4 months ago • 2 comments

.bat scripts can only be executed on Windows when their paths use backslashes, not forward slashes. For this reason, local execution carefully replaces forward slashes with backslashes in the executable of a Spawn when executing on Windows.

This commit adds equivalent logic for the case of remote execution on Windows from any host:

  • Remote execution replaces forward slashes with backslashes in the first argument when executing on Windows.
  • Most calls to PathFragment#getCallablePathString are replaced with the new execution platform aware getCallablePathStringForOs. This affects test actions, in which various wrappers execute different executables (e.g. --run_under targets) and thus can have Bazel-controlled executable path strings in locations other than the argv[0].

Fixes #11636

fmeum avatar Oct 15 '24 18:10 fmeum