Skip to content

Commit

Permalink
Merge pull request #181 from ashleygwilliams/migerh-fix-spinners
Browse files Browse the repository at this point in the history
Let the spinners spin again
  • Loading branch information
ashleygwilliams authored Jun 15, 2018
2 parents 1b0120e + e30ed47 commit 1c50b12
Show file tree
Hide file tree
Showing 14 changed files with 614 additions and 571 deletions.
8 changes: 3 additions & 5 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ use PBAR;

pub fn cargo_install_wasm_bindgen(step: &Step) -> Result<(), Error> {
let msg = format!("{}Installing WASM-bindgen...", emoji::DOWN_ARROW);
let pb = PBAR.step(step, &msg);
PBAR.step(step, &msg)?;
let output = Command::new("cargo")
.arg("install")
.arg("wasm-bindgen-cli")
.arg("--force")
.output()?;
pb.finish();
if !output.status.success() {
let s = String::from_utf8_lossy(&output.stderr);
if s.contains("already exists") {
PBAR.info("wasm-bindgen already installed");
PBAR.info("wasm-bindgen already installed")?;
return Ok(());
}
Error::cli("Installing wasm-bindgen failed", s)
Expand All @@ -34,7 +33,7 @@ pub fn wasm_bindgen_build(
step: &Step,
) -> Result<(), Error> {
let msg = format!("{}Running WASM-bindgen...", emoji::RUNNER);
let pb = PBAR.step(step, &msg);
PBAR.step(step, &msg)?;
let binary_name = name.replace("-", "_");
let release_or_debug = if debug { "debug" } else { "release" };
let wasm_path = format!(
Expand All @@ -60,7 +59,6 @@ pub fn wasm_bindgen_build(
.arg(dts_arg)
.arg(target_arg)
.output()?;
pb.finish();
if !output.status.success() {
let s = String::from_utf8_lossy(&output.stderr);
Error::cli("wasm-bindgen failed to execute properly", s)
Expand Down
7 changes: 3 additions & 4 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use PBAR;

pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> {
let msg = format!("{}Adding WASM target...", emoji::TARGET);
let pb = PBAR.step(step, &msg);
PBAR.step(step, &msg)?;
ensure_nightly()?;
let output = Command::new("rustup")
.arg("target")
Expand All @@ -15,7 +15,6 @@ pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> {
.arg("--toolchain")
.arg("nightly")
.output()?;
pb.finish();
if !output.status.success() {
let s = String::from_utf8_lossy(&output.stderr);
Error::cli("Adding the wasm32-unknown-unknown target failed", s)
Expand All @@ -42,7 +41,7 @@ fn ensure_nightly() -> Result<(), Error> {

pub fn cargo_build_wasm(path: &str, debug: bool, step: &Step) -> Result<(), Error> {
let msg = format!("{}Compiling to WASM...", emoji::CYCLONE);
let pb = PBAR.step(step, &msg);
PBAR.step(step, &msg)?;
let output = {
let mut cmd = Command::new("cargo");
cmd.current_dir(path).arg("+nightly").arg("build");
Expand All @@ -52,7 +51,7 @@ pub fn cargo_build_wasm(path: &str, debug: bool, step: &Step) -> Result<(), Erro
cmd.arg("--target").arg("wasm32-unknown-unknown");
cmd.output()?
};
pb.finish();

if !output.status.success() {
let s = String::from_utf8_lossy(&output.stderr);
Error::cli("Compilation of your program failed", s)
Expand Down
Loading

0 comments on commit 1c50b12

Please sign in to comment.