(args: &[&str])
| 33 | static PROVIDER_LOCK: Mutex<()> = Mutex::new(()); |
| 34 | |
| 35 | async fn run_cli(args: &[&str]) -> Result<String, String> { |
| 36 | let mut cmd = openshell_cmd(); |
| 37 | cmd.args(args).stdout(Stdio::piped()).stderr(Stdio::piped()); |
| 38 | |
| 39 | let output = cmd |
| 40 | .output() |
| 41 | .await |
| 42 | .map_err(|e| format!("failed to spawn openshell {}: {e}", args.join(" ")))?; |
| 43 | |
| 44 | let stdout = String::from_utf8_lossy(&output.stdout).to_string(); |
| 45 | let stderr = String::from_utf8_lossy(&output.stderr).to_string(); |
| 46 | let combined = format!("{stdout}{stderr}"); |
| 47 | |
| 48 | if !output.status.success() { |
| 49 | return Err(format!( |
| 50 | "openshell {} failed (exit {:?}):\n{combined}", |
| 51 | args.join(" "), |
| 52 | output.status.code() |
| 53 | )); |
| 54 | } |
| 55 | |
| 56 | Ok(combined) |
| 57 | } |
| 58 | |
| 59 | async fn delete_provider(name: &str) { |
| 60 | let mut cmd = openshell_cmd(); |
no test coverage detected