Skip to content

fix(invoke): exit non-zero when cshell resolve fails#124

Merged
scarmuega merged 1 commit into
mainfrom
fix/invoke-nonzero-exit-on-resolve-error
Jun 17, 2026
Merged

fix(invoke): exit non-zero when cshell resolve fails#124
scarmuega merged 1 commit into
mainfrom
fix/invoke-nonzero-exit-on-resolve-error

Conversation

@scarmuega

Copy link
Copy Markdown
Contributor

Problem

trix invoke swallows a failed resolve. tx_invoke_interactive (src/spawn/cshell.rs) runs cshell via .output() but never checks the exit status, so when cshell fails — e.g. a TRP resolve error like ❗️ error: target type not supported: Custom(...) — the message is printed to the inherited stderr but the function still returns Ok(()), and trix invoke exits 0. Callers and CI can't detect the failure by exit code.

Fix

Capture the command output and bail on a non-success status, exactly as the sibling tx_invoke_json already does:

if !output.status.success() {
    bail!("CShell failed to execute transaction");
}

The error then propagates wallet.invoke_interactivecommands/invoke.rsmain() -> Result<()>, so the process exits non-zero. A successful --skip-submit invoke still exits 0 and prints {hash, cbor} as before.

Testing

cargo build, cargo clippy, and cargo test all pass (21 tests).

🤖 Generated with Claude Code

`tx_invoke_interactive` ran cshell via `.output()` but never inspected
the exit status, so a failed `trix invoke` (e.g. a TRP resolve error)
printed `❗️ error: …` and still returned `Ok(())` — the process exited 0.

Check `output.status.success()` and bail on failure, mirroring the
sibling `tx_invoke_json`. The error now propagates through
`wallet.invoke_interactive` → the invoke command → `main`, yielding a
non-zero exit so callers and CI can detect a failed resolve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@scarmuega scarmuega merged commit 45778d7 into main Jun 17, 2026
6 checks passed
@scarmuega scarmuega deleted the fix/invoke-nonzero-exit-on-resolve-error branch June 17, 2026 21:05
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.

1 participant