fix: better loggin on subprcess failures
continuous-integration/drone/pr Build is passing

This commit is contained in:
Darragh Elliott
2025-08-26 10:15:18 +00:00
parent a3949c5a4c
commit 2b70db152a
+16 -8
View File
@@ -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: