From 48e5d8048ae52b58060187de9a8f32d73fe7ea55 Mon Sep 17 00:00:00 2001 From: Robin Gottschalk Date: Sat, 22 Mar 2025 12:43:22 +0100 Subject: [PATCH] Silence git command output to prevent cmd window to spawn --- src/git.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/git.rs b/src/git.rs index 676fb1c..40234a7 100644 --- a/src/git.rs +++ b/src/git.rs @@ -1,7 +1,7 @@ use chrono::Local; use git2::{Error, Repository, StatusOptions}; use std::path::Path; -use std::process::Command; +use std::process::{Command, Stdio}; pub fn current_change_count(repo_path: &Path) -> Result { // Open the repository at the provided path @@ -43,6 +43,7 @@ pub fn backup_changes(repo_path: &Path) -> Result<(), Box .arg("add") .arg("-A") .current_dir(repo_path) + .stdout(Stdio::null()) .status()?; if !status.success() { return Err("git add failed".into()); @@ -57,6 +58,7 @@ pub fn backup_changes(repo_path: &Path) -> Result<(), Box .arg("-m") .arg(&commit_message) .current_dir(repo_path) + .stdout(Stdio::null()) .status()?; if !status.success() { return Err("git commit failed".into()); @@ -68,6 +70,7 @@ pub fn backup_changes(repo_path: &Path) -> Result<(), Box .arg("origin") .arg("main") .current_dir(repo_path) + .stdout(Stdio::null()) .status()?; if !status.success() { return Err("git push failed".into());