Skip to content
Snippets Groups Projects
Commit ca5a6510 authored by nfontrod's avatar nfontrod
Browse files

src/checkout.rs: fix rm problem

parent 94ed510b
No related branches found
No related tags found
No related merge requests found
use crate::commit; use crate::commit;
use std::{ use std::{
path::PathBuf, path::PathBuf,
process::{exit, Command} process::{exit, Command},
}; };
/// Check if two commits are differents /// Check if two commits are differents
...@@ -79,16 +79,13 @@ pub fn prepare_checkout() { ...@@ -79,16 +79,13 @@ pub fn prepare_checkout() {
} }
} }
/// Function that perform a checkout on your results /// Function that perform a checkout on your results
pub fn checkout(mode: &str) { pub fn checkout(mode: &str) {
let (borg_path, results) = commit::check_path(); let (borg_path, results) = commit::check_path();
if mode == "hard" { if mode == "hard" {
let output = Command::new("rm") let cmd = format!("rm -r {}/*", results.to_str().unwrap());
.arg("-r") let output = Command::new("sh").arg("-c").arg(cmd).output().unwrap();
.arg(format!("{}/*", results.to_str().unwrap())) println!("{}", String::from_utf8(output.stdout).unwrap());
.output()
.unwrap();
match output.status.code().unwrap() { match output.status.code().unwrap() {
0 => (), 0 => (),
num => { num => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment