From 727e6f84cbba9d147dd88d8753d6d8ccc37c10e5 Mon Sep 17 00:00:00 2001 From: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:56:31 +0100 Subject: [PATCH] cli: Fix toolchain `solana_version` override log (#2719) --- cli/src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cli/src/lib.rs b/cli/src/lib.rs index d7c97a3dc3..173425de24 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -45,7 +45,7 @@ use std::ffi::OsString; use std::fs::{self, File}; use std::io::prelude::*; use std::path::{Path, PathBuf}; -use std::process::{Child, ExitStatus, Stdio}; +use std::process::{Child, Stdio}; use std::str::FromStr; use std::string::ToString; use tar::Archive; @@ -519,7 +519,7 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result std::io::Result { + fn override_solana_version(version: String) -> std::io::Result { std::process::Command::new("solana-install") .arg("init") .arg(&version) @@ -527,16 +527,17 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result restore_cbs.push(Box::new(|| { - match override_solana_version(current_version)?.success() { + match override_solana_version(solana_version.to_owned())? { + true => restore_cbs.push(Box::new(|| { + match override_solana_version(current_version)? { true => Ok(()), false => Err(anyhow!("Failed to restore `solana` version")), } })), - Err(_) => { + false => { eprintln!( "Failed to override `solana` version to {solana_version}, \ using {current_version} instead"