Struct commandext::CommandExt
[−]
[src]
pub struct CommandExt { /* fields omitted */ }
Extends std::io::process::Command
.
Methods
impl CommandExt
[src]
fn new(cmd: &str) -> CommandExt
Create a new CommandExt.
Arguments
- cmd - The command to use, i.e. "echo".
- exec - The Executable to use when executing the command.
Note
On Windows, the cmd is built as "sh -c", and the cmd is added to the shargs string. When the command is exeuted, this results in "sh -c 'shargs'".
fn wd(&mut self, wd: &Path) -> &mut CommandExt
Set the working directory for the command.
Arguments
wd
- The working directory for the command execution.
fn header(&mut self, show_header: bool) -> &mut CommandExt
Set the header boolean.
Arguments
- show_header - true, a header showing what will be executed is printed on stdout. Otherwise, no header is printed.
fn arg(&mut self, arg: &str) -> &mut CommandExt
Add an argument to the command.
Arguments
- arg - The argument to add to the command.
Note
On Windows, the argument is appended to the shargs value.
fn args(&mut self, args: &[&str]) -> &mut CommandExt
Add arguments to the command.
Arguments
args
- A vector of argments to add to the command.
Note
On Windows, the arguments are appended to the shargs value.
fn env(&mut self, key: &str, val: &str) -> &mut CommandExt
Set the command environment.
Arguments
key
- The key for the variable.value
- The value for the variable.
fn exec<T>(&mut self, execfn: fn(_: &mut Command) -> T) -> T
Execute the Command, returning result 'T'
Arguments
execfn
- A closure taking a Command, executes it via output or spawn and returns result typeT
.