Skip to content

Commit

Permalink
Fix binary tool version check
Browse files Browse the repository at this point in the history
  • Loading branch information
cyqsimon committed Sep 16, 2023
1 parent 7d6501d commit f594570
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/install/krate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::install::Tool;
use anyhow::Result;
use log::debug;
use serde::Deserialize;
const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");

Expand All @@ -25,6 +26,10 @@ impl Krate {
.call()?;

let kr: KrateResponse = res.into_json()?;
debug!(
"Latest `{name}` version on crates.io is {}",
kr.krate.max_version
);
Ok(kr.krate)
}
}
4 changes: 2 additions & 2 deletions src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn check_version(tool: &Tool, path: &Path, expected_version: &str) -> Result

let v = get_cli_version(tool, path)?;
info!(
"Checking installed `{}` version == expected version: {} == {}",
r#"Checking installed `{}` version == expected version: "{}" == "{}""#,
tool, v, &expected_version
);
Ok(v == expected_version)
Expand All @@ -110,7 +110,7 @@ pub fn get_cli_version(tool: &Tool, path: &Path) -> Result<String> {
let mut cmd = Command::new(path);
cmd.arg("--version");
let stdout = child::run_capture_stdout(cmd, tool)?;
let version = stdout.trim().split_whitespace().nth(1);
let version = stdout.trim().split_whitespace().last();
match version {
Some(v) => Ok(v.to_string()),
None => bail!("Something went wrong! We couldn't determine your version of the wasm-bindgen CLI. We were supposed to set that up for you, so it's likely not your fault! You should file an issue: https://github.com/rustwasm/wasm-pack/issues/new?template=bug_report.md.")
Expand Down

0 comments on commit f594570

Please sign in to comment.