feat(rclone.exe): method run_command
Added for executes command to rclone utility
This commit is contained in:
1 parent
281406a920
commit
5ccc7739b0
1 file changed
+19
@@ -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())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user