Bläddra i källkod

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

Ruven Salamon 2 år sedan
förälder
incheckning
010b400669
2 ändrade filer med 6 tillägg och 1 borttagningar
  1. 1 0
      CHANGELOG.md
  2. 5 1
      avm/src/anchor/main.rs

+ 1 - 0
CHANGELOG.md

@@ -24,6 +24,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)).
 - idl: Update the IDL program to use non-deprecated account types ([#2365](https://github.com/coral-xyz/anchor/pull/2365)).
 - ts: Enum fields weren't being converted from snake_case to camelCase ([#2378](https://github.com/coral-xyz/anchor/pull/2378)).
 

+ 5 - 1
avm/src/anchor/main.rs

@@ -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() {
+        std::process::exit(exit.status.code().unwrap_or(1));
+    }
+
     Ok(())
 }