Struct std::process::Command
Re-export from std::process::unix::Command
Builder for creating a process.
Example
use std::process::{Stdio, Command};
use std::string::trim;
use std::fs::Path;
let command = Command::new(Path::new("/usr/bin/uname"))
.stdout(Stdio::Piped)
.args(&["-s"]);
let output = command.spawn()
.unwrap()
.wait_with_output()
.unwrap();
defer output.free();
// Prints "Running on Linux"
println!("Running on {}", output.stdout[..].trim());
Run this example
Methods
impl Command { ... }
-
-
Set command line arguments.
-
Set environment variables.
-
Set the stdin redirection type
-
Set the stdout redirection type
-
Set the stderr redirection type
-
Spawn a process.