Run a small command on the sandbox over SSH and capture its stdout. Used by the download flow to probe whether the source path is a regular file or a directory before streaming the tar archive. Stderr is inherited so the user still sees any diagnostic output from ssh itself.
(session: &SshSessionConfig, command: &str)
| 1067 | /// file or a directory before streaming the tar archive. Stderr is inherited |
| 1068 | /// so the user still sees any diagnostic output from ssh itself. |
| 1069 | async fn ssh_run_capture_stdout(session: &SshSessionConfig, command: &str) -> Result<String> { |
| 1070 | let mut ssh = ssh_base_command(&session.proxy_command); |
| 1071 | ssh.arg("-T") |
| 1072 | .arg("-o") |
| 1073 | .arg("RequestTTY=no") |
| 1074 | .arg("sandbox") |
| 1075 | .arg(command) |
| 1076 | .stdin(Stdio::null()) |
| 1077 | .stdout(Stdio::piped()) |
| 1078 | .stderr(Stdio::inherit()); |
| 1079 | let output = tokio::task::spawn_blocking(move || ssh.output()) |
| 1080 | .await |
| 1081 | .into_diagnostic()? |
| 1082 | .into_diagnostic()?; |
| 1083 | if !output.status.success() { |
| 1084 | return Err(miette::miette!( |
| 1085 | "ssh probe exited with status {}", |
| 1086 | output.status |
| 1087 | )); |
| 1088 | } |
| 1089 | Ok(String::from_utf8_lossy(&output.stdout).trim().to_string()) |
| 1090 | } |
| 1091 | |
| 1092 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 1093 | enum SandboxSourceKind { |
no test coverage detected