Fix output of commands not being printed
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index b7eab21..fdeda21 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -647,7 +647,7 @@
def print_bazel_version_info(bazel_binary, platform):
print_collapsed_group(":information_source: Bazel Info")
- version_output = execute_command(
+ version_output = execute_command_and_get_output(
[bazel_binary]
+ common_startup_flags(platform)
+ ["--nomaster_bazelrc", "--bazelrc=/dev/null", "version"]
@@ -1119,7 +1119,7 @@
return targets
-def execute_command(args, shell=False, fail_if_nonzero=True):
+def execute_command_and_get_output(args, shell=False, fail_if_nonzero=True):
eprint(" ".join(args))
process = subprocess.run(
args,
@@ -1128,13 +1128,18 @@
env=os.environ,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
- errors='replace',
+ errors="replace",
universal_newlines=True,
)
eprint(process.stdout)
return process.stdout
+def execute_command(args, shell=False, fail_if_nonzero=True):
+ eprint(" ".join(args))
+ return subprocess.run(args, shell=shell, check=fail_if_nonzero, env=os.environ).returncode
+
+
def execute_command_background(args):
eprint(" ".join(args))
return subprocess.Popen(args, env=os.environ)