From 30398c5068eb82de712aaf709c9e7b3ba15baeca Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 22 Oct 2026 10:53:09 -0500 Subject: [PATCH] Exit with an error when a predefined action fails Actions are wrapped so that an interactive user can try another one after an error, but a predefined action runs only once, so a failed headless save or upload printed the error and exited 0, as if it had succeeded. --- src/heretic/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/heretic/main.py b/src/heretic/main.py index 4d70c87..a3b1d97 100644 --- a/src/heretic/main.py +++ b/src/heretic/main.py @@ -1417,6 +1417,11 @@ def run(): else: print(f"[red]Error: {formatted}[/]") + # A predefined action is not retried, so without this, a failed + # headless run would exit as if it had succeeded. + if settings.model_action is not None: + sys.exit(1) + def main(): # Install Rich traceback handler.