Skip to main content

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 extract::extract;
9pub use init::init;
10pub use list::list;
11pub use mount::{mount, umount};
12pub use prune::prune;
13
14mod compact;
15mod create;
16mod extract;
17mod init;
18mod list;
19mod mount;
20mod prune;
21
22pub(crate) async fn execute_borg(
23    local_path: &str,
24    args: Vec<String>,
25    passphrase: &Option<String>,
26) -> Result<Output, io::Error> {
27    Ok(if let Some(passphrase) = passphrase {
28        tokio::process::Command::new(local_path)
29            .env("BORG_PASSPHRASE", passphrase)
30            .args(args)
31            .output()
32            .await?
33    } else {
34        tokio::process::Command::new(local_path)
35            .args(args)
36            .output()
37            .await?
38    })
39}