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

Function run_cli

e2e/rust/tests/host_gateway_alias.rs:22–44  ·  view source on GitHub ↗
(args: &[&str])

Source from the content-addressed store, hash-verified

20static INFERENCE_ROUTE_LOCK: Mutex<()> = Mutex::new(());
21
22async 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
46struct HostServer {
47 port: u16,

Calls 2

openshell_cmdFunction · 0.85
successMethod · 0.45

Tested by

no test coverage detected