MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_sync_down_directory

Function sandbox_sync_down_directory

crates/openshell-cli/src/ssh.rs:1294–1319  ·  view source on GitHub ↗
(
    session: &SshSessionConfig,
    sandbox_path: &str,
    dest: &str,
)

Source from the content-addressed store, hash-verified

1292}
1293
1294async fn sandbox_sync_down_directory(
1295 session: &SshSessionConfig,
1296 sandbox_path: &str,
1297 dest: &str,
1298) -> Result<()> {
1299 let dest_path = Path::new(dest);
1300 if let Ok(existing) = fs::symlink_metadata(dest_path)
1301 && !existing.is_dir()
1302 {
1303 return Err(miette::miette!(
1304 "cannot extract directory '{sandbox_path}' over non-directory destination '{}'",
1305 dest_path.display()
1306 ));
1307 }
1308 fs::create_dir_all(dest_path)
1309 .into_diagnostic()
1310 .wrap_err_with(|| {
1311 format!(
1312 "failed to create local destination directory '{}'",
1313 dest_path.display()
1314 )
1315 })?;
1316
1317 let tar_cmd = format!("tar cf - -C {path} .", path = shell_escape(sandbox_path));
1318 stream_sandbox_tar(session, tar_cmd, dest_path).await
1319}
1320
1321/// Run the SSH proxy, connecting stdin/stdout to the gateway.
1322pub async fn sandbox_ssh_proxy(

Callers 1

sandbox_sync_downFunction · 0.85

Calls 1

stream_sandbox_tarFunction · 0.85

Tested by

no test coverage detected