From b85478b205e97b7596b30f411ec28d042a938f64 Mon Sep 17 00:00:00 2001 From: Danny Browning Date: Tue, 3 Oct 2023 13:34:43 -0600 Subject: [PATCH] fix: output errors when install fails (#21) Co-authored-by: Danny Browning --- cli/src/install/npm.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cli/src/install/npm.rs b/cli/src/install/npm.rs index 7d3622d..2562b9e 100644 --- a/cli/src/install/npm.rs +++ b/cli/src/install/npm.rs @@ -1,4 +1,5 @@ use spinners::{Spinner, Spinners}; +use std::io::BufRead; use std::path::Path; use tokio::process::Command; @@ -45,7 +46,20 @@ pub async fn npm_install( .output() .await?; if !out.status.success() { - anyhow::bail!("Failed to install app template dependencies"); + log::error!("Failed to install"); + let b = std::io::BufReader::new(std::io::Cursor::new(out.stdout)); + for l in b.lines() { + if let Ok(l) = l { + log::error!("{l}"); + } + } + let b = std::io::BufReader::new(std::io::Cursor::new(out.stderr)); + for l in b.lines() { + if let Ok(l) = l { + log::error!("err: {l}"); + } + } + anyhow::bail!("Failed to install, please see output"); } s.stop_with_newline(); Ok(())