diff --git a/src/git/mod.rs b/src/git/mod.rs index 8ccc4b1..deaff44 100644 --- a/src/git/mod.rs +++ b/src/git/mod.rs @@ -1,4 +1,4 @@ -use std::process::Command; +use std::process::{Command, Stdio}; use crate::env; use crate::nxfs::config::LogLevel; @@ -138,13 +138,17 @@ fn show_stash() { println!("{}", str::from_utf8(&list.stdout).unwrap()); } +/// Spawn git pull process pub fn git_pull() { - let mut pull = Command::new("git") + let pull = Command::new("git") .arg("pull") + .stdout(Stdio::piped()) .spawn() .expect("Failed to execute pull command"); - let wait_pull = pull.wait().expect("Failed to wait pull command"); - if !wait_pull.success() { + let wait_pull = pull + .wait_with_output() + .expect("Failed to wait pull command"); + if !wait_pull.status.success() { log_from_log_level(LogLevel::Error, "Failed to pull from remote repository"); } } diff --git a/src/upgrade/mod.rs b/src/upgrade/mod.rs index ecac672..f64672c 100644 --- a/src/upgrade/mod.rs +++ b/src/upgrade/mod.rs @@ -8,7 +8,6 @@ use throbber::Throbber; /// Check if there's a new version of nyx and if so update the current one pub fn upgrade_bin() { change_work_dir(&utils::env::get_nyx_env_var()); - git::git_pull(); let nyx_art = utils::nyx_ascii_art(); // throbber let mut building_throbber = Throbber::new() @@ -18,6 +17,8 @@ pub fn upgrade_bin() { .message("Updating NYX...".to_owned()) .frames(&throbber::ROTATE_F); println!("{}", nyx_art.truecolor(138, 43, 226)); + println!("Pulling from remote repository..."); + git::git_pull(); building_throbber.start(); // nyx version