(args: &[&str])
| 20 | static INFERENCE_ROUTE_LOCK: Mutex<()> = Mutex::new(()); |
| 21 | |
| 22 | async fn run_cli(args: &[&str]) -> Result<String, String> { |
| 23 | let mut cmd = openshell_cmd(); |
| 24 | cmd.args(args).stdout(Stdio::piped()).stderr(Stdio::piped()); |
| 25 | |
| 26 | let output = cmd |
| 27 | .output() |
| 28 | .await |
| 29 | .map_err(|e| format!("failed to spawn openshell {}: {e}", args.join(" ")))?; |
| 30 | |
| 31 | let stdout = String::from_utf8_lossy(&output.stdout).to_string(); |
| 32 | let stderr = String::from_utf8_lossy(&output.stderr).to_string(); |
| 33 | let combined = format!("{stdout}{stderr}"); |
| 34 | |
| 35 | if !output.status.success() { |
| 36 | return Err(format!( |
| 37 | "openshell {} failed (exit {:?}):\n{combined}", |
| 38 | args.join(" "), |
| 39 | output.status.code() |
| 40 | )); |
| 41 | } |
| 42 | |
| 43 | Ok(combined) |
| 44 | } |
| 45 | |
| 46 | struct HostServer { |
| 47 | port: u16, |
no test coverage detected