Escape captured Windows' where.exe output.

This is in preparation of upgrading to bazel 4.0, which flipped `--incompatible_restrict_string_escapes`.

PiperOrigin-RevId: 353656022
Change-Id: Ide31ead6e968c94f3d6106a78ebc1b6b00746eab
This commit is contained in:
Christian Sigg 2021-01-25 08:53:44 -08:00 committed by TensorFlower Gardener
parent 03c97a204f
commit a054a5a7ad

View File

@ -24,10 +24,12 @@ def which(repository_ctx, program_name):
if is_windows(repository_ctx):
if not program_name.endswith(".exe"):
program_name = program_name + ".exe"
result = execute(repository_ctx, ["C:\\Windows\\System32\\where.exe", program_name])
else:
result = execute(repository_ctx, ["which", program_name])
return result.stdout.rstrip()
return execute(
repository_ctx,
["C:\\Windows\\System32\\where.exe", program_name],
).stdout.replace("\\", "\\\\").rstrip()
return execute(repository_ctx, ["which", program_name]).stdout.rstrip()
def get_python_bin(repository_ctx):
"""Gets the python bin path.