Add rust zfsbackup

This commit is contained in:
2026-04-25 01:33:15 +02:00
commit 5f3369cf46
4 changed files with 113 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
pub fn exec_command(command: &Vec<String>) -> Result<(), String> {
if command.is_empty() {
return Err("Command is empty".to_string());
}
let mut cmd = std::process::Command::new(&command[0]);
if command.len() > 1 {
cmd.args(&command[1..]);
}
let output = cmd.output().map_err(|e| e.to_string())?;
if !output.status.success() {
return Err(format!(
"Command {:?} failed with status {}: {}",
command,
output.status,
String::from_utf8_lossy(&output.stderr)
));
}
Ok(())
}