| 1595 | } |
| 1596 | |
| 1597 | fn launch_editor_command(binary: &str, label: &str, remote_target: &str) -> Result<()> { |
| 1598 | let status = Command::new(binary) |
| 1599 | .arg("--remote") |
| 1600 | .arg(remote_target) |
| 1601 | .arg("/sandbox") |
| 1602 | .stdin(Stdio::null()) |
| 1603 | .stdout(Stdio::null()) |
| 1604 | .stderr(Stdio::null()) |
| 1605 | .spawn(); |
| 1606 | |
| 1607 | match status { |
| 1608 | Ok(_) => Ok(()), |
| 1609 | Err(err) if err.kind() == std::io::ErrorKind::NotFound => Err(miette::miette!( |
| 1610 | "{} is not installed or not on PATH", |
| 1611 | binary |
| 1612 | )), |
| 1613 | Err(err) => Err(err) |
| 1614 | .into_diagnostic() |
| 1615 | .wrap_err(format!("failed to launch {label}")), |
| 1616 | } |
| 1617 | } |
| 1618 | |
| 1619 | /// Print an SSH config `Host` block for a sandbox to stdout. |
| 1620 | /// |