Skip to content

feat(cli): add structured exit codes for improper termination - #2137

Closed
rwinkelman wants to merge 3 commits into
NVIDIA:mainfrom
rwinkelman:fix/cli-exit-codes-1221
Closed

feat(cli): add structured exit codes for improper termination#2137
rwinkelman wants to merge 3 commits into
NVIDIA:mainfrom
rwinkelman:fix/cli-exit-codes-1221

Conversation

@rwinkelman

Copy link
Copy Markdown

Summary

  • Adds garak.exit_codes.ExitCode with positive status codes per arch: give exit codes on improper exit #1221 (shells truncate negatives).
  • Exits with INTERRUPTED (1) on KeyboardInterrupt and UNSPECIFIED (127) on GarakException/ValueError.
  • Allows subclasses to set GarakException.exit_code for finer-grained mapping in follow-ups.

Fixes #1221 (initial wiring; component-specific codes can land incrementally).

Test plan

  • pytest tests/test_exit_codes.py

Introduces positive ExitCode values (issue NVIDIA#1221) and exits with
INTERRUPTED on KeyboardInterrupt and UNSPECIFIED for GarakException.

Signed-off-by: Ray Winkelman <rwinkelman@users.noreply.github.com>
@rwinkelman
rwinkelman force-pushed the fix/cli-exit-codes-1221 branch from e78d029 to faf9c33 Compare September 1, 2026 07:44
)

Wrap probe, detector, evaluator, generator, langservice, buff, and reporting
failures in typed GarakException subclasses so garak exits with stable codes.

Signed-off-by: Ray Winkelman <rwinkelman@users.noreply.github.com>
@rwinkelman

Copy link
Copy Markdown
Author

Follow-up: harness now wraps probe/detector/evaluator failures; generator load, langservice, buff load, and report digest failures propagate component-specific exit codes.

@rwinkelman
rwinkelman force-pushed the fix/cli-exit-codes-1221 branch from f6d5181 to bd0de61 Compare September 1, 2026 08:02
Signed-off-by: Ray Winkelman <rwinkelman@users.noreply.github.com>
@jmartin-tech

Copy link
Copy Markdown
Collaborator

Closing in favor of #1790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arch: give exit codes on improper exit

2 participants