MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run_atomic

Function run_atomic

atomic-cli/tests/provenance_rpc_sink.rs:210–236  ·  view source on GitHub ↗
(args: &[&str], current_dir: &Path, stdin: Option<&[u8]>)

Source from the content-addressed store, hash-verified

208}
209
210fn run_atomic(args: &[&str], current_dir: &Path, stdin: Option<&[u8]>) -> std::process::Output {
211 let mut command = Command::new(env!("CARGO_BIN_EXE_atomic"));
212 command
213 .args(args)
214 .current_dir(current_dir)
215 .stdin(if stdin.is_some() {
216 Stdio::piped()
217 } else {
218 Stdio::null()
219 })
220 .stdout(Stdio::piped())
221 .stderr(Stdio::piped());
222 let mut child = command.spawn().expect("spawn atomic");
223 if let (Some(stdin), Some(mut pipe)) = (stdin, child.stdin.take()) {
224 use std::io::Write;
225 pipe.write_all(stdin).expect("write hook payload");
226 }
227 let output = child.wait_with_output().expect("wait for atomic");
228 assert!(
229 output.status.success(),
230 "atomic {:?} failed: stdout: {}; stderr: {}",
231 args,
232 String::from_utf8_lossy(&output.stdout),
233 String::from_utf8_lossy(&output.stderr)
234 );
235 output
236}
237
238#[cfg(unix)]
239#[tokio::test(flavor = "multi_thread", worker_threads = 2)]

Calls 1

spawnMethod · 0.80

Tested by

no test coverage detected