Skip to content

fix: preserve miden wrapper child exit codes - #245

Open
omerbek wants to merge 1 commit into
0xMiden:nextfrom
omerbek:fix/preserve-wrapper-exit-code
Open

fix: preserve miden wrapper child exit codes#245
omerbek wants to merge 1 commit into
0xMiden:nextfrom
omerbek:fix/preserve-wrapper-exit-code

Conversation

@omerbek

@omerbek omerbek commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserves the wrapped component process exit code when miden successfully dispatches to a child command.

Fixes #243.

Why

Config::execute_command() already returns the child process ExitStatus, but miden_wrapper converted every non-zero child status into an anyhow error. Since main returned anyhow::Result<()>, all child failures collapsed to process exit code 1 at the wrapper boundary.

That makes CI callers unable to distinguish component-specific exit codes, usage errors, or panic exits from wrapped tools.

Changes

  • Return std::process::ExitCode through the top-level command execution path.
  • Convert normal child exit statuses to the same wrapper exit code instead of turning them into wrapper errors.
  • Preserve the current error path for failures to resolve or spawn the child process.
  • Map Unix signal termination to 128 + signal where available, with a failure fallback otherwise.
  • Add a Unix regression test that installs a fixture miden-vm exiting 42 and verifies miden vm exits with 42.

Testing

  • cargo check
  • cargo clippy --lib --bins -- -D warnings
  • cargo test --test miden integration_miden_preserves_component_exit_code (Windows: test is cfg(unix), so it compiles and is filtered out locally; it exercises the shell-script fixture on Unix CI)
  • cargo test --test operations --no-run
  • git diff --check

Notes from local Windows validation:

  • cargo test / cargo clippy --all-targets --all-features currently compile unrelated Unix-only test code paths on Windows (std::os::unix::fs::symlink in existing tests), so they do not complete locally.
  • cargo fmt --check reports repository-wide newline-style issues under this Windows checkout; the submitted diff was checked for whitespace with git diff --check and the PR compare was verified to avoid CRLF-only churn.

@omerbek
omerbek force-pushed the fix/preserve-wrapper-exit-code branch from 298d3c5 to f4f61f7 Compare September 1, 2026 19:07
@omerbek
omerbek changed the base branch from main to next September 2, 2026 05:20
@bitwalker

Copy link
Copy Markdown
Collaborator

Your commits need to be signed

@omerbek
omerbek force-pushed the fix/preserve-wrapper-exit-code branch from f4f61f7 to a4f9ad2 Compare September 5, 2026 10:24
@omerbek

omerbek commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

The commit is now SSH-signed and GitHub shows it as verified (a4f9ad2).

The remaining CI failure is separate from the signature check: verify / release lint and verify / package closure both fail at cargo make release ... with Task "release" not found. I tried updating the branch onto next, but GitHub rejected the branch update because the base history includes a workflow file change and my token cannot update .github/workflows/ci.yml. The code checks that ran against this head are green (build, lint, unit tests, integration tests, rustfmt).

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.

miden wrapper collapses every component exit code to 1

2 participants