From ac6c71bc0b717e5ac8d4777c53b6546ca88d39c0 Mon Sep 17 00:00:00 2001 From: Contsantine Bulany <61948252+lostl1ght@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:05:28 +0300 Subject: [PATCH] feat: disable output of git init/remote get-url/checkout --- src/handlers/install_handler.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/handlers/install_handler.rs b/src/handlers/install_handler.rs index 9845e6f..22356d8 100644 --- a/src/handlers/install_handler.rs +++ b/src/handlers/install_handler.rs @@ -13,6 +13,7 @@ use std::path::Path; use tokio::fs::File; use tokio::io::AsyncWriteExt; use tokio::{fs, process::Command}; +use std::process::Stdio; use tracing::info; use yansi::Paint; @@ -301,7 +302,12 @@ async fn handle_building_from_source( if let Err(error) = fs::metadata(".git").await { match error.kind() { std::io::ErrorKind::NotFound => { - Command::new("git").arg("init").spawn()?.wait().await?; + Command::new("git") + .arg("init") + .stdout(Stdio::null()) + .spawn()? + .wait() + .await?; } _ => return Err(anyhow!("unknown error: {}", error)), @@ -313,10 +319,11 @@ async fn handle_building_from_source( .arg("remote") .arg("get-url") .arg("origin") + .stdout(Stdio::null()) .spawn()? .wait() .await?; - + if !remote.success() { // add neovim's remote Command::new("git") @@ -348,15 +355,16 @@ async fn handle_building_from_source( .spawn()? .wait() .await?.success(); - + if !fetch_successful { return Err(anyhow!("Git fetch did not succeed")); } - + // checkout fetched files Command::new("git") .arg("checkout") .arg("FETCH_HEAD") + .stdout(Stdio::null()) .spawn()? .wait() .await?;