From c6866d05dba096f4be67c0368926eff7ffcbe121 Mon Sep 17 00:00:00 2001 From: Nitin Srinivasan Date: Tue, 26 Nov 2024 18:16:47 -0800 Subject: [PATCH] Add a check for return codes of `executor.run` so that we propagate error codes correctly PiperOrigin-RevId: 700518396 --- build/build.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build/build.py b/build/build.py index 12ad0fa3b011..0eb6fd9a83ee 100755 --- a/build/build.py +++ b/build/build.py @@ -399,8 +399,11 @@ async def main(): else: requirements_command.append("//build:requirements.update") - await executor.run(requirements_command.get_command_as_string(), args.dry_run) - sys.exit(0) + result = await executor.run(requirements_command.get_command_as_string(), args.dry_run) + if result.return_code != 0: + raise RuntimeError(f"Command failed with return code {result.return_code}") + else: + sys.exit(0) wheel_cpus = { "darwin_arm64": "arm64", @@ -594,7 +597,11 @@ async def main(): wheel_build_command.append(f"--jaxlib_git_hash={git_hash}") - await executor.run(wheel_build_command.get_command_as_string(), args.dry_run) + result = await executor.run(wheel_build_command.get_command_as_string(), args.dry_run) + if result.return_code != 0: + raise RuntimeError(f"Command failed with return code {result.return_code}") + else: + sys.exit(0) if __name__ == "__main__":