diff --git a/scripts/print_exported_headers.py b/scripts/print_exported_headers.py index 31f70fb9ba7..f9e9d227b9f 100755 --- a/scripts/print_exported_headers.py +++ b/scripts/print_exported_headers.py @@ -14,6 +14,7 @@ import json import os import subprocess +import sys from typing import List, Set # Run buck2 from the same directory (and thus repo) as this script. @@ -22,7 +23,14 @@ def run(command: List[str]) -> str: """Run subprocess and return its output.""" - result = subprocess.run(command, capture_output=True, check=True, cwd=BUCK_CWD) + try: + result = subprocess.run(command, capture_output=True, check=True, cwd=BUCK_CWD) + except subprocess.CalledProcessError as ex: + print( + f"Subprocess failed. stdout: {ex.stdout}\nstderr: {ex.stderr}", + file=sys.stderr, + ) + raise return result.stdout.decode()