From 6b73350f2168ce55a874f618c962fddc0dadfe22 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 30 Sep 2026 08:54:59 +0100 Subject: Show NvPCR check command errors --- scripts/tpm_nvpcr.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts/tpm_nvpcr.py') diff --git a/scripts/tpm_nvpcr.py b/scripts/tpm_nvpcr.py index 14a250c..4f110fa 100644 --- a/scripts/tpm_nvpcr.py +++ b/scripts/tpm_nvpcr.py @@ -30,7 +30,11 @@ INITRD_UNITS = ( def run(*command: str) -> str: - result = subprocess.run(command, capture_output=True, text=True, check=True) + try: + result = subprocess.run(command, capture_output=True, text=True, check=True) + except subprocess.CalledProcessError as exc: + detail = (exc.stderr or exc.stdout or "no error output").strip() + raise RuntimeError(f"{command[0]} exited {exc.returncode}: {detail}") from exc return result.stdout @@ -142,6 +146,6 @@ def main() -> int: if __name__ == "__main__": try: sys.exit(main()) - except (OSError, TypeError, ValueError, subprocess.CalledProcessError) as exc: + except (OSError, TypeError, ValueError, RuntimeError) as exc: print(f"NvPCR check failed: {exc}", file=sys.stderr) sys.exit(1) -- cgit v1.3.1