Skip to content

Conversation

radik878
Copy link
Contributor

@radik878 radik878 commented Oct 3, 2025

Motivation

The TestOutcome::ensure_ok method calls std::process::exit(1), which makes the library code difficult to reuse (impossible to intercept/handle on the caller's side).

Solution

Replaced both calls to std::process::exit(1) in ensure_ok with a return to Err(...). This matches the method signature and the general error model in the project.
To avoid “breaking” quiet modes (JUnit/JSON) with an additional error string, I corrected the high-level error printing in crates/forge/bin/main.rs. Now sh_err!(“{err:?}”) is definitely printed there before process::exit(1). It is enough to wrap the print with a condition: do not print if shell::is_quiet() or shell::is_json(), but only set the exit code to 1.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant