Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: fixes bug where the wrong exit status is reported #2370

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The minor version will be incremented upon a breaking change and the patch versi

- cli: Don't regenerate idl in read_all_programs(). ([#2332](https://github.com/coral-xyz/anchor/pull/2332)).
- ts: `provider.simulate` will send the transaction with `sigVerify: false` if no `signers` are present ([#2331](https://github.com/coral-xyz/anchor/pull/2331)).
- cli: Failing commands will return the correct exit status. ([#2370](https://github.com/coral-xyz/anchor/pull/2370)).

### Breaking

Expand Down
6 changes: 5 additions & 1 deletion avm/src/anchor/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ fn main() -> anyhow::Result<()> {
version
);
}
Command::new(binary_path)
let exit = Command::new(binary_path)
.args(args)
.spawn()?
.wait_with_output()
.expect("Failed to run anchor-cli");

if !exit.status.success() {
Henry-E marked this conversation as resolved.
Show resolved Hide resolved
std::process::exit(exit.status.code().unwrap_or(1));
}

Ok(())
}