Skip to content

Commit

Permalink
Merge #3361
Browse files Browse the repository at this point in the history
3361: Give users feedback when they are running "wasmer add ..." r=fschutt a=Michael-F-Bryan

Fixes #3350.

Co-authored-by: Michael-F-Bryan <michael@wasmer.io>
Co-authored-by: Felix Schütt <12084016+fschutt@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 23, 2022
2 parents 2b49d1b + 0d17535 commit 70ece9f
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions lib/cli/src/commands/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,26 @@ impl Add {
let bindings = self.lookup_bindings(&registry)?;

let mut cmd = self.target()?.command(&bindings)?;
cmd.stdin(Stdio::null())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit());

#[cfg(feature = "debug")]
log::debug!("Running {cmd:?}");

let status = cmd
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.status()
.with_context(|| {
format!(
"Unable to start \"{:?}\". Is it installed?",
cmd.get_program()
)
})?;
println!("Running: {cmd:?}");

let status = cmd.status().with_context(|| {
format!(
"Unable to start \"{:?}\". Is it installed?",
cmd.get_program()
)
})?;

anyhow::ensure!(status.success(), "Command failed: {:?}", cmd);

Ok(())
}

fn lookup_bindings(&self, registry: &str) -> Result<Vec<Bindings>, Error> {
#[cfg(feature = "debug")]
log::debug!("Querying WAPM for the bindings packages");
println!("Querying WAPM for package bindings");

let mut bindings_to_add = Vec::new();
let language = self.target()?.language();
Expand Down

0 comments on commit 70ece9f

Please sign in to comment.