fix(invoke): exit non-zero when cshell resolve fails#124
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
trix invokeswallows 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 returnsOk(()), andtrix invokeexits 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_jsonalready does:The error then propagates
wallet.invoke_interactive→commands/invoke.rs→main() -> Result<()>, so the process exits non-zero. A successful--skip-submitinvoke still exits 0 and prints{hash, cbor}as before.Testing
cargo build,cargo clippy, andcargo testall pass (21 tests).🤖 Generated with Claude Code