From 2233ee7ff2eb13e2509044533e0e7ab43199d2d4 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 19 Dec 2024 07:49:52 +1100 Subject: [PATCH] cli: Ignore non semver solana/agave releases to avoid panic (#3432) --- CHANGELOG.md | 1 + cli/src/lib.rs | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4184eb8b..db2631b24a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,6 +103,7 @@ The minor version will be incremented upon a breaking change and the patch versi - lang: Require `zero` accounts to be unique ([#3409](https://github.com/coral-xyz/anchor/pull/3409)). - lang: Deduplicate `zero` accounts against `init` accounts ([#3422](https://github.com/coral-xyz/anchor/pull/3422)). - cli: Fix custom `provider.cluster` ([#3428](https://github.com/coral-xyz/anchor/pull/3428)). +- cli: Ignore non semver solana/agave releases to avoid panic ([#3432](https://github.com/coral-xyz/anchor/pull/3432)). ### Breaking diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 05e8434f23..03ff43d19a 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -556,16 +556,16 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result String { - Regex::new(r"(\d+\.\d+\.\S+)") - .unwrap() - .captures_iter(text) - .next() - .unwrap() - .get(0) - .unwrap() - .as_str() - .to_string() + fn parse_version(text: &str) -> Option { + Some( + Regex::new(r"(\d+\.\d+\.\S+)") + .unwrap() + .captures_iter(text) + .next()? + .get(0)? + .as_str() + .to_string(), + ) } fn get_current_version(cmd_name: &str) -> Result { @@ -577,8 +577,8 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result Result