Fix batch command execution on Windows (#275)
* Fix batch command execution on Windows
Change-Id: I2c7cba21e47309af28ae85f9bf9825c266410aca
* Fix typo
Change-Id: I41a0016ba9d5a89978c73b6688cc43b2767fe0aa
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 8667da0..3823bc0 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -365,7 +365,10 @@
print_collapsed_group(":gcloud: Downloading Bazel Under Test")
bazel_binary = download_bazel_binary(tmpdir, platform)
print_bazel_version_info(bazel_binary)
- execute_shell_commands(config.get("shell_commands", None))
+ if platform == "windows":
+ execute_batch_commands(config.get("batch_commands", None))
+ else:
+ execute_shell_commands(config.get("shell_commands", None))
execute_bazel_run(bazel_binary, config.get("run_targets", None))
if not test_only:
build_bep_file = os.path.join(tmpdir, "build_bep.json")
@@ -633,6 +636,13 @@
os.chdir(clone_path)
+def execute_batch_commands(commands):
+ if not commands:
+ return
+ print_collapsed_group(":batch: Setup (Batch Commands)")
+ batch_commands = "&".join(commands)
+ return subprocess.run(batch_commands, shell=True, check=True).returncode
+
def execute_shell_commands(commands):
if not commands:
return