Skip to content

Commit

Permalink
cli: Fix toolchain solana_version override log (#2719)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Dec 6, 2023
1 parent dfee958 commit 727e6f8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -519,24 +519,25 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result<RestoreToolchainC
// We are overriding with `solana-install` command instead of using the binaries
// from `~/.local/share/solana/install/releases` because we use multiple Solana
// binaries in various commands.
fn override_solana_version(version: String) -> std::io::Result<ExitStatus> {
fn override_solana_version(version: String) -> std::io::Result<bool> {
std::process::Command::new("solana-install")
.arg("init")
.arg(&version)
.stderr(Stdio::null())
.stdout(Stdio::null())
.spawn()?
.wait()
.map(|status| status.success())
}

match override_solana_version(solana_version.to_owned()) {
Ok(_) => 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"
Expand Down

1 comment on commit 727e6f8

@vercel
Copy link

@vercel vercel bot commented on 727e6f8 Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-git-master-200ms.vercel.app
anchor-docs-200ms.vercel.app
anchor-lang.com
www.anchor-lang.com

Please sign in to comment.