borgbackup/asynchronous/
mod.rs

1//! The asynchronous version of the borg commands are defined in this module
2
3use std::io;
4use std::process::Output;
5
6pub use compact::compact;
7pub use create::{create, create_progress, CreateProgress};
8pub use init::init;
9pub use list::list;
10pub use mount::{mount, umount};
11pub use prune::prune;
12
13mod compact;
14mod create;
15mod init;
16mod list;
17mod mount;
18mod prune;
19
20pub(crate) async fn execute_borg(
21    local_path: &str,
22    args: Vec<String>,
23    passphrase: &Option<String>,
24) -> Result<Output, io::Error> {
25    Ok(if let Some(passphrase) = passphrase {
26        tokio::process::Command::new(local_path)
27            .env("BORG_PASSPHRASE", passphrase)
28            .args(args)
29            .output()
30            .await?
31    } else {
32        tokio::process::Command::new(local_path)
33            .args(args)
34            .output()
35            .await?
36    })
37}