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

Method run_with_stdin

atomic-cli/tests/it/remote_sandbox_client_test.rs:210–247  ·  view source on GitHub ↗
(&self, cwd: &Path, args: &[&str], stdin: Option<&str>)

Source from the content-addressed store, hash-verified

208 }
209
210 fn run_with_stdin(&self, cwd: &Path, args: &[&str], stdin: Option<&str>) -> Output {
211 let mut command = Command::new(env!("CARGO_BIN_EXE_atomic"));
212 command
213 .args(args)
214 .current_dir(cwd)
215 .env("HOME", self.home.path())
216 .env("ATOMIC_DAEMON_BIN", "/nonexistent/atomicd")
217 .env_remove("ATOMIC_RPC")
218 .env_remove("RUST_LOG")
219 .stdin(if stdin.is_some() {
220 Stdio::piped()
221 } else {
222 Stdio::null()
223 })
224 .stdout(Stdio::piped())
225 .stderr(Stdio::piped());
226 match &self.socket {
227 Some(socket) => {
228 command
229 .env("ATOMIC_SERVICE", "reactor")
230 .env("ATOMIC_DAEMON_SOCKET", socket);
231 }
232 None => {
233 command.env("ATOMIC_SERVICE", "local");
234 }
235 }
236 let mut child = command.spawn().expect("run atomic");
237 if let Some(input) = stdin {
238 use std::io::Write;
239 child
240 .stdin
241 .take()
242 .unwrap()
243 .write_all(input.as_bytes())
244 .unwrap();
245 }
246 child.wait_with_output().unwrap()
247 }
248}
249
250fn text(output: &Output) -> String {

Callers 2

runMethod · 0.80
hookFunction · 0.80

Calls 4

spawnMethod · 0.80
pathMethod · 0.45
unwrapMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected