message: feat(install): break out get cli version function
diff: @@ -75,24 +75,24 @@ pub fn check_version(
  expected_version.to_string()
  };
  - let mut cmd = Command::new(path);
  - cmd.arg("--version");
  - child::run_capture_stdout(cmd, tool)
  - .map(|stdout| {
  - stdout
  - .trim()
  - .split_whitespace()
  - .nth(1)
  - .map(|v| {
  + let v = get_cli_version(tool, path)?;
  info!(
  "Checking installed `{}` version == expected version: {} == {}",
  tool, v, &expected_version
  );
  Ok(v == expected_version)
  - })
  - .unwrap_or(Ok(false))
  - })
  - .unwrap_or(Ok(false))
  +}
  +
  +/// Fetches the version of a CLI tool
  +pub fn get_cli_version(tool: &Tool, path: &PathBuf) -> Result<String, failure::Error> {
  + 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);
  + 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.")
  + }
  }
  /// Downloads a precompiled copy of the tool, if available.
  