From cab9e010f6818c279a9eb61229f0ed2ca2987c58 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Wed, 23 Nov 2022 17:48:56 +0800 Subject: [PATCH 1/2] Use println!() instead of the log crate --- lib/cli/src/commands/add.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index eb331c23b8c..05a3545c610 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -42,8 +42,7 @@ impl Add { let mut cmd = self.target()?.command(&bindings)?; - #[cfg(feature = "debug")] - log::debug!("Running {cmd:?}"); + println!("Running: {cmd:?}"); let status = cmd .stdin(Stdio::null()) @@ -63,8 +62,7 @@ impl Add { } fn lookup_bindings(&self, registry: &str) -> Result, 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(); From 8f28ea4c9f59ed0f62674e3bbb68eb465b50a238 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Wed, 23 Nov 2022 17:49:32 +0800 Subject: [PATCH 2/2] Stdout/stderr should be inherited --- lib/cli/src/commands/add.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/cli/src/commands/add.rs b/lib/cli/src/commands/add.rs index 05a3545c610..f52964936f3 100644 --- a/lib/cli/src/commands/add.rs +++ b/lib/cli/src/commands/add.rs @@ -41,20 +41,18 @@ impl Add { let bindings = self.lookup_bindings(®istry)?; let mut cmd = self.target()?.command(&bindings)?; + cmd.stdin(Stdio::null()) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()); println!("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() - ) - })?; + let status = cmd.status().with_context(|| { + format!( + "Unable to start \"{:?}\". Is it installed?", + cmd.get_program() + ) + })?; anyhow::ensure!(status.success(), "Command failed: {:?}", cmd);