Probe the sandbox-side source path. The path is assumed to have already been validated by `validate_sandbox_source_path`.
(
session: &SshSessionConfig,
sandbox_path: &str,
)
| 1098 | /// Probe the sandbox-side source path. The path is assumed to have already |
| 1099 | /// been validated by `validate_sandbox_source_path`. |
| 1100 | async fn probe_sandbox_source_kind( |
| 1101 | session: &SshSessionConfig, |
| 1102 | sandbox_path: &str, |
| 1103 | ) -> Result<SandboxSourceKind> { |
| 1104 | let probe_cmd = format!( |
| 1105 | "if [ -d {path} ]; then printf dir; elif [ -e {path} ]; then printf file; else printf missing; fi", |
| 1106 | path = shell_escape(sandbox_path), |
| 1107 | ); |
| 1108 | let kind = ssh_run_capture_stdout(session, &probe_cmd).await?; |
| 1109 | match kind.as_str() { |
| 1110 | "dir" => Ok(SandboxSourceKind::Directory), |
| 1111 | "file" => Ok(SandboxSourceKind::File), |
| 1112 | "missing" => Err(miette::miette!( |
| 1113 | "sandbox source path '{sandbox_path}' does not exist" |
| 1114 | )), |
| 1115 | other => Err(miette::miette!( |
| 1116 | "unexpected probe output for sandbox source path '{sandbox_path}': '{other}'" |
| 1117 | )), |
| 1118 | } |
| 1119 | } |
| 1120 | |
| 1121 | /// Pull a path from a sandbox to a local destination using tar-over-SSH. |
| 1122 | /// |
no test coverage detected