1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

fix(fbcode_builder): fail the build when cmake build fails

Summary:
This change causes fbcode_builder (getdeps.py) to fail immediately on most non-zero error codes from delegated commands.

While internal tools may be able to surface failures in a build that doesn't fail fast, the debug cycle is difficult externally -- this makes failures pop out more easily and has been instrumental in debugging OSS build issues.

X-link: https://github.com/facebook/sapling/pull/1099

Differential Revision: D77608371

Pulled By: quark-zju

fbshipit-source-id: e9fc00a574bc64fbc165a22e51406e85d015e2ae
This commit is contained in:
ben--
2025-07-03 14:28:13 -07:00
committed by Facebook GitHub Bot
parent 4f0db407cf
commit 603a3a6686
4 changed files with 51 additions and 35 deletions

View File

@@ -42,6 +42,13 @@ def _print_env_diff(env, log_fn) -> None:
log_fn("+ %s=%s \\\n" % (k, shellquote(env[k])))
def check_cmd(cmd, **kwargs) -> None:
"""Run the command and abort on failure"""
rc = run_cmd(cmd, **kwargs)
if rc != 0:
raise RuntimeError(f"Failure exit code {rc} for command {cmd}")
def run_cmd(cmd, env=None, cwd=None, allow_fail: bool = False, log_file=None) -> int:
def log_to_stdout(msg):
sys.stdout.buffer.write(msg.encode(errors="surrogateescape"))