From 5ccc7739b0f4b32768e8ea90f85bcb88396a1fb1 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 24 Feb 2026 11:05:30 +0300 Subject: [PATCH] feat(rclone.exe): method run_command Added for executes command to rclone utility --- src/rcloneInstall.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/rcloneInstall.rs b/src/rcloneInstall.rs index 7534c18..7011e11 100644 --- a/src/rcloneInstall.rs +++ b/src/rcloneInstall.rs @@ -52,4 +52,23 @@ impl RcloneApp { println!("rclone успешно установлен!"); Ok(()) } + + pub fn run_command(&self, args: &[&str]) -> Result { + 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()) + } + } }