Struct commandext::CommandExt [] [src]

pub struct CommandExt {
    // some 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.

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.

fn args(&mut self, args: &[&str]) -> &mut CommandExt

Add arguments to the command.

Arguments

  • args - A vector of argments to add to the command.

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(cmd: &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 type T.