From 2b70db152a619e146859075982e043f043482c43 Mon Sep 17 00:00:00 2001 From: Darragh Elliott Date: Tue, 26 Aug 2025 10:15:18 +0000 Subject: [PATCH] fix: better loggin on subprcess failures --- build/fsfe_website_build/lib/misc.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/build/fsfe_website_build/lib/misc.py b/build/fsfe_website_build/lib/misc.py index cd3e2bf98d..498059e59f 100644 --- a/build/fsfe_website_build/lib/misc.py +++ b/build/fsfe_website_build/lib/misc.py @@ -88,14 +88,22 @@ def lang_from_filename(file: Path) -> str: def run_command(commands: list) -> str: - result = subprocess.run( - commands, - capture_output=True, - # Get output as str instead of bytes - text=True, - check=True, - ) - return result.stdout.strip() + try: + result = subprocess.run( + commands, + capture_output=True, + # Get output as str instead of bytes + text=True, + check=True, + ) + return result.stdout.strip() + except subprocess.CalledProcessError as error: + logger.error( + f"Command: {error.cmd} returned non zero exit code {error.returncode}" + f"\nstdout: {error.stdout}" + f"\nstderr: {error.stderr}" + ) + sys.exit(1) def get_version(file: Path) -> int: