feat(rclone.exe): method run_command

Added for executes command to rclone utility
This commit is contained in:
Black_Raven committed 2026-02-24 11:05:30 +03:00
1 parent 281406a920
commit 5ccc7739b0
1 file changed
+19
+19
View File
@@ -52,4 +52,23 @@ impl RcloneApp {
println!("rclone успешно установлен!"); println!("rclone успешно установлен!");
Ok(()) Ok(())
} }
pub fn run_command(&self, args: &[&str]) -> Result<String, String> {
println!(
"Запускаю: {} {}",
self.rclone_path.display(),
args.join(" ")
);
let output = Command::new(&self.rclone_path)
.args(args)
.output()
.map_err(|e| format!("Ошибка запуска: {}", e))?;
if output.status.success() {
Ok(String::from_utf8_lossy(&output.stdout).to_string())
} else {
Err(String::from_utf8_lossy(&output.stderr).to_string())
}
}
} }