From 2cbed9def87de25f19970bff902c691b2f354276 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Thu, 5 Sep 2024 18:32:49 +0300 Subject: [PATCH] cxxrtl: don't drop backtrace on ^C. --- niar/cxxrtl.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/niar/cxxrtl.py b/niar/cxxrtl.py index 8cd0bf2..974e42a 100644 --- a/niar/cxxrtl.py +++ b/niar/cxxrtl.py @@ -3,6 +3,7 @@ import json import logging import os import shutil +import sys from enum import Enum, nonmember from functools import partial from pathlib import Path @@ -12,9 +13,10 @@ from amaranth.back import rtlil from .build import construct_top from .cmdrunner import CommandRunner -from .logging import logtime +from .logging import logtime, logger from .project import Project + __all__ = ["add_arguments"] CXXFLAGS = [ @@ -271,7 +273,11 @@ def main(np: Project, args): if args.vcd: cmd += ["--vcd", args.vcd] with logtime(logging.DEBUG, "run"): - cr.run_cmd(cmd, step="run") + try: + cr.run_cmd(cmd, step="run") + except KeyboardInterrupt: + print(file=sys.stderr) + logger.log(logging.INFO, "aborting on KeyboardInterrupt") def _make_yosys_relative(path):