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

Function run_cli

e2e/rust/tests/live_policy_update.rs:144–158  ·  view source on GitHub ↗

Run an `openshell` CLI command and return the result.

(args: &[&str])

Source from the content-addressed store, hash-verified

142
143/// Run an `openshell` CLI command and return the result.
144async fn run_cli(args: &[&str]) -> CliResult {
145 let mut cmd = openshell_cmd();
146 cmd.args(args).stdout(Stdio::piped()).stderr(Stdio::piped());
147
148 let output = cmd.output().await.expect("spawn openshell command");
149 let stdout = String::from_utf8_lossy(&output.stdout).to_string();
150 let stderr = String::from_utf8_lossy(&output.stderr).to_string();
151 let combined = strip_ansi(&format!("{stdout}{stderr}"));
152
153 CliResult {
154 success: output.status.success(),
155 output: combined,
156 exit_code: output.status.code(),
157 }
158}
159
160/// Extract the policy version number from `policy get` output.
161///

Calls 4

openshell_cmdFunction · 0.85
strip_ansiFunction · 0.85
codeMethod · 0.80
successMethod · 0.45

Tested by

no test coverage detected