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:213–250  ·  view source on GitHub ↗
(&self, cwd: &Path, args: &[&str], stdin: Option<&str>)

Source from the content-addressed store, hash-verified

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