Skip to content

Commit a7fa98f

Browse files
committed
add a check for return code
1 parent 482635c commit a7fa98f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

build/build.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def add_artifact_subcommand_arguments(parser: argparse.ArgumentParser):
293293
compile_group.add_argument(
294294
"--target_cpu",
295295
default=None,
296-
help="CPU platform to target. Default is the same as the host machine. ",
296+
help="CPU platform to target. Default is the same as the host machine.",
297297
)
298298

299299
compile_group.add_argument(
@@ -399,8 +399,11 @@ async def main():
399399
else:
400400
requirements_command.append("//build:requirements.update")
401401

402-
await executor.run(requirements_command.get_command_as_string(), args.dry_run)
403-
sys.exit(0)
402+
result = await executor.run(requirements_command.get_command_as_string(), args.dry_run)
403+
if result.return_code != 0:
404+
raise RuntimeError(f"Command failed with return code {result.return_code}")
405+
else:
406+
sys.exit(0)
404407

405408
wheel_cpus = {
406409
"darwin_arm64": "arm64",
@@ -594,8 +597,12 @@ async def main():
594597

595598
wheel_build_command.append(f"--jaxlib_git_hash={git_hash}")
596599

597-
await executor.run(wheel_build_command.get_command_as_string(), args.dry_run)
600+
result = await executor.run(wheel_build_command.get_command_as_string(), args.dry_run)
601+
if result.return_code != 0:
602+
raise RuntimeError(f"Command failed with return code {result.return_code}")
603+
else:
604+
sys.exit(0)
598605

599606

600607
if __name__ == "__main__":
601-
asyncio.run(main())
608+
asyncio.run(main())

0 commit comments

Comments
 (0)