From 944321f5d9c924aa64936b99b134591bdc760e79 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Fri, 27 Sep 2024 17:44:19 +1000 Subject: [PATCH] cmdrunner: report exit statuses. --- niar/cmdrunner.py | 10 ++++++---- niar/cxxrtl.py | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/niar/cmdrunner.py b/niar/cmdrunner.py index 06ab3d2..544bb00 100644 --- a/niar/cmdrunner.py +++ b/niar/cmdrunner.py @@ -123,13 +123,15 @@ class CommandRunner: failed = [] for cu, proc in runnables: - if proc is not None and proc.wait() != 0: - failed.append(cu) + if proc is not None: + status = proc.wait() + if status != 0: + failed.append((cu, status)) if failed: logger.error("the following process(es) failed:") - for cu in failed: - logger.error(f" {formatted(cu)}") + for (cu, status) in failed: + logger.error(f" {formatted(cu)} (status={status})") raise CommandFailedError(f"failed {step} step") for cu, _ in runnables: diff --git a/niar/cxxrtl.py b/niar/cxxrtl.py index 9aad1fc..b412c74 100644 --- a/niar/cxxrtl.py +++ b/niar/cxxrtl.py @@ -286,6 +286,8 @@ def main(np: Project, args): except KeyboardInterrupt: print(file=sys.stderr) logger.log(logging.INFO, "aborting on KeyboardInterrupt") + except CommandFailedError: + logger.log(logging.INFO, "aborting on CommandFailedError") def _make_yosys_relative(path):