mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-19 07:53:54 +01:00
Move a bunch of git ops to use the git binary (#302)
This commit is contained in:
16
src-tauri/yaak-git/src/binary.rs
Normal file
16
src-tauri/yaak-git/src/binary.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use crate::error::Error::GitNotFound;
|
||||
use crate::error::Result;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
pub(crate) fn new_binary_command(dir: &Path) -> Result<Command> {
|
||||
let status = Command::new("git").arg("--version").status();
|
||||
|
||||
if let Err(_) = status {
|
||||
return Err(GitNotFound);
|
||||
}
|
||||
|
||||
let mut cmd = Command::new("git");
|
||||
cmd.arg("-C").arg(dir);
|
||||
Ok(cmd)
|
||||
}
|
||||
Reference in New Issue
Block a user