MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / run_capture

Function run_capture

tools/generate-client-api/src/main.rs:29–39  ·  view source on GitHub ↗

Run a command and return captured stdout as UTF-8 string.

(cmd: &str, args: &[&str])

Source from the content-addressed store, hash-verified

27
28/// Run a command and return captured stdout as UTF-8 string.
29fn run_capture(cmd: &str, args: &[&str]) -> Result<String> {
30 let out = Command::new(cmd)
31 .args(args)
32 .stdin(Stdio::null())
33 .output()
34 .with_context(|| format!("Failed to start {cmd}"))?;
35 if !out.status.success() {
36 return Err(anyhow!("Command failed: {cmd} {args:?} (exit {})", out.status));
37 }
38 Ok(String::from_utf8(out.stdout)?)
39}
40
41fn main() -> Result<()> {
42 let out_dir = "src/sdk/client_api";

Callers 1

mainFunction · 0.85

Calls 5

stdinMethod · 0.80
successMethod · 0.80
newFunction · 0.50
ErrFunction · 0.50
OkFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…