Function spawn_process

Source
pub fn spawn_process(cmd: &str, args: Vec<String>) -> Result<Child, Error>
Expand description

Spawn a new process with piped stdout and stderr.

Launches a subprocess with the given command and arguments. Both stdout and stderr are piped and can be accessed via the returned Child.

§Arguments

  • cmd - Command to execute
  • args - Command line arguments

§Examples

use ej_io::process::spawn_process;

let mut child = spawn_process("echo", vec!["Hello".to_string()]).unwrap();
let output = child.stdout.take().unwrap();