First look in the local path for the wasm-opt binary. Use whatever binary is found and assume it works

master
Brennon Loveless 4 years ago
parent d46d1c69b7
commit f66d321ba9
  1. 12
      src/wasm_opt.rs

@ -3,7 +3,7 @@
use crate::child;
use crate::install::{self, Tool};
use crate::PBAR;
use binary_install::Cache;
use binary_install::{Cache, Download};
use std::path::Path;
use std::process::Command;
@ -58,6 +58,16 @@ pub fn find_wasm_opt(
cache: &Cache,
install_permitted: bool,
) -> Result<install::Status, failure::Error> {
// First attempt to look up in PATH. If found assume it works.
if let Ok(path) = which::which("wasm-opt") {
PBAR.info(&format!("found wasm-opt at {:?}", path));
match path.as_path().parent() {
Some(path) => return Ok(install::Status::Found(Download::at(path))),
_ => {}
}
}
let version = "version_78";
Ok(install::download_prebuilt(
&install::Tool::WasmOpt,

Loading…
Cancel
Save