Silence git command output to prevent cmd window to spawn
This commit is contained in:
parent
a429f9a496
commit
48e5d8048a
|
|
@ -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<usize, Error> {
|
||||
// Open the repository at the provided path
|
||||
|
|
@ -43,6 +43,7 @@ pub fn backup_changes(repo_path: &Path) -> Result<(), Box<dyn std::error::Error>
|
|||
.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<dyn std::error::Error>
|
|||
.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<dyn std::error::Error>
|
|||
.arg("origin")
|
||||
.arg("main")
|
||||
.current_dir(repo_path)
|
||||
.stdout(Stdio::null())
|
||||
.status()?;
|
||||
if !status.success() {
|
||||
return Err("git push failed".into());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user