Struct exec::Command
[−]
[src]
pub struct Command { /* fields omitted */ }
Build a command to execute. This has an API which is deliberately
similar to std::process::Command
.
let err = exec::Command::new("echo") .arg("hello") .arg("world") .exec(); println!("Error: {}", err);
If the exec
function succeeds, it will never return.
Methods
impl Command
[src]
fn new<S: AsRef<OsStr>>(program: S) -> Command
[src]
Create a new command builder, specifying the program to run. The
program will be searched for using the usual rules for PATH
.
fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Command
[src]
Add an argument to the command builder. This can be chained.
fn args<S: AsRef<OsStr>>(&mut self, args: &[S]) -> &mut Command
[src]
Add multiple arguments to the command builder. This can be chained.
let err = exec::Command::new("echo") .args(&["hello", "world"]) .exec(); println!("Error: {}", err);
fn exec(&mut self) -> Error
[src]
Execute the command we built. If this function succeeds, it will never return.