update
This commit is contained in:
parent
b416507e4a
commit
738c7ed504
2 changed files with 14 additions and 3 deletions
|
@ -23,7 +23,11 @@ pub fn ensure_exists(dir: &str) {
|
|||
}
|
||||
|
||||
pub fn run_backup_rsync(conf: &RsyncConfig) {
|
||||
println!("Running backup for {} -> {}", conf.src, conf.dest);
|
||||
println!(
|
||||
"Running backup for {} -> {}",
|
||||
conf.src.paint(Color::Blue),
|
||||
conf.dest.paint(Color::Yellow)
|
||||
);
|
||||
|
||||
if let Some(dir) = &conf.ensure_exists {
|
||||
ensure_exists(&dir);
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,4 +1,5 @@
|
|||
use backup::run_backup;
|
||||
use yansi::{Color, Paint};
|
||||
|
||||
mod backup;
|
||||
mod config;
|
||||
|
@ -15,7 +16,7 @@ fn main() {
|
|||
}
|
||||
|
||||
pub fn run_command(cmd: &[&str]) -> (String, String) {
|
||||
println!("--> {} ", cmd.join(" "));
|
||||
println!("--> {} ", cmd.join(" ").paint(Color::Blue));
|
||||
|
||||
let mut cmd_setup = std::process::Command::new(cmd[0]);
|
||||
let mut cmd_setup = cmd_setup.args(cmd.iter().skip(1).collect::<Vec<_>>());
|
||||
|
@ -27,7 +28,13 @@ pub fn run_command(cmd: &[&str]) -> (String, String) {
|
|||
let child = cmd_setup.spawn().unwrap();
|
||||
|
||||
let status = child.wait_with_output().unwrap();
|
||||
assert!(status.status.success());
|
||||
if !status.status.success() {
|
||||
println!(
|
||||
"{} Command {} returned with non zero exit code.",
|
||||
"Error:".paint(Color::Red),
|
||||
cmd.join(" ")
|
||||
);
|
||||
}
|
||||
|
||||
let output = String::from_utf8(status.stdout).unwrap();
|
||||
let stderr = String::from_utf8(status.stderr).unwrap();
|
||||
|
|
Loading…
Reference in a new issue