(
session: &SshSessionConfig,
sandbox_path: &str,
dest: &str,
)
| 1292 | } |
| 1293 | |
| 1294 | async 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. |
| 1322 | pub async fn sandbox_ssh_proxy( |
no test coverage detected