diff options
Diffstat (limited to 'src/remote/git.rs')
| -rw-r--r-- | src/remote/git.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/remote/git.rs b/src/remote/git.rs index a4c1c28..66c5a89 100644 --- a/src/remote/git.rs +++ b/src/remote/git.rs @@ -1,6 +1,6 @@ -use std::io::Result; +use std::io::{Error, ErrorKind::Other, Result}; use std::path::PathBuf; -use std::process::Command; +use std::process::{Command, Stdio}; use std::time::{SystemTime, UNIX_EPOCH}; pub struct Git; @@ -19,7 +19,7 @@ impl super::Remote for Git { fn sync_up(&self, remote: &str, directory: &PathBuf) -> Result<()> { let timestamp = SystemTime::now().duration_since(UNIX_EPOCH) - .expect("Invalid time") + .map_err(|_| Error::new(Other, "Invalid time"))? .as_millis(); let commands = vec![ @@ -33,8 +33,10 @@ impl super::Remote for Git { Command::new("sh") .arg("-c") .arg(&command) + .stdout(Stdio::null()) + .stderr(Stdio::null()) .status() - .expect("Failed while performing sync up with git"); + .map_err(|_| Error::new(Other, "Failed while performing sync up with git"))?; } Ok(()) @@ -52,8 +54,10 @@ impl super::Remote for Git { Command::new("sh") .arg("-c") .arg(&command) + .stdout(Stdio::null()) + .stderr(Stdio::null()) .status() - .expect("Failed while performing sync down with git"); + .map_err(|_| Error::new(Other, "Failed while performing sync down with git"))?; } Ok(()) } |