MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / run_cli

Function run_cli

e2e/rust/tests/websocket_conformance.rs:35–57  ·  view source on GitHub ↗
(args: &[&str])

Source from the content-addressed store, hash-verified

33static PROVIDER_LOCK: Mutex<()> = Mutex::new(());
34
35async 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
59async fn delete_provider(name: &str) {
60 let mut cmd = openshell_cmd();

Callers 1

create_generic_providerFunction · 0.70

Calls 2

openshell_cmdFunction · 0.85
successMethod · 0.45

Tested by

no test coverage detected