use std::fs;
use std::io;
use std::path::Path;
use std::process::{Command, Stdio};
use error;
use failure::Error;
pub fn clone_app(src: &Path, dst: &Path) -> Result<(), Error> {
Command::new("git")
.arg("clone")
.arg(src)
.arg(dst)
.stderr(Stdio::null())
.stdout(Stdio::null())
.status()
.map(|_| ())?;
Ok(())
}
pub fn clear(path: &Path) -> Result<(), Error> {
if let Err(e) = fs::remove_dir_all(path) {
if e.kind() != io::ErrorKind::NotFound {
bail!(error::KrankerlError::Other {
cause: "could not delete artifacts dir".to_string(),
});
}
}
fs::create_dir_all(path)?;
Ok(())
}