LCOV - code coverage report
Current view: top level - compute_tools/src/bin/fast_import - s5cmd.rs (source / functions) Coverage Total Hit
Test: 20b6afc7b7f34578dcaab2b3acdaecfe91cd8bf1.info Lines: 0.0 % 19 0
Test Date: 2024-11-25 17:48:16 Functions: 0.0 % 2 0

            Line data    Source code
       1              : use anyhow::Context;
       2              : use camino::Utf8Path;
       3              : 
       4              : use super::s3_uri::S3Uri;
       5              : 
       6            0 : pub(crate) async fn sync(local: &Utf8Path, remote: &S3Uri) -> anyhow::Result<()> {
       7            0 :     let mut builder = tokio::process::Command::new("s5cmd");
       8              :     // s5cmd uses aws-sdk-go v1, hence doesn't support AWS_ENDPOINT_URL
       9            0 :     if let Some(val) = std::env::var_os("AWS_ENDPOINT_URL") {
      10            0 :         builder.arg("--endpoint-url").arg(val);
      11            0 :     }
      12            0 :     builder
      13            0 :         .arg("sync")
      14            0 :         .arg(local.as_str())
      15            0 :         .arg(remote.to_string());
      16            0 :     let st = builder
      17            0 :         .spawn()
      18            0 :         .context("spawn s5cmd")?
      19            0 :         .wait()
      20            0 :         .await
      21            0 :         .context("wait for s5cmd")?;
      22            0 :     if st.success() {
      23            0 :         Ok(())
      24              :     } else {
      25            0 :         Err(anyhow::anyhow!("s5cmd failed"))
      26              :     }
      27            0 : }
        

Generated by: LCOV version 2.1-beta