Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/git/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::process::Command;
use std::process::{Command, Stdio};

use crate::env;
use crate::nxfs::config::LogLevel;
Expand Down Expand Up @@ -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");
}
}
3 changes: 2 additions & 1 deletion src/upgrade/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down