pub struct Cmd { /* private fields */ }
Expand description
Clone-able variant of std::process::Command
with some build specific helper methods
Cloning allows configuring commands with some common arguments and then invoking it with additional arguments/env vars at different places inside the script.
Method of this type are mirroring those of std::process::Command with addition of run
and
run_result
commands for easier use inside of build sript.
Implementations§
Source§impl Cmd
impl Cmd
Sourcepub fn new<S: AsRef<OsStr>>(program: S) -> Self
pub fn new<S: AsRef<OsStr>>(program: S) -> Self
Constructs a new Cmd for launching the executable at path program
Sourcepub fn arg<S: AsRef<OsStr>>(self, arg: S) -> Self
pub fn arg<S: AsRef<OsStr>>(self, arg: S) -> Self
Adds an argument to the list of execution arguments
Sourcepub fn args<I, S>(self, args: I) -> Self
pub fn args<I, S>(self, args: I) -> Self
Adds multiple arguments to the list of execution arguments
Sourcepub fn env<K: AsRef<OsStr>, V: AsRef<OsStr>>(self, env: K, val: V) -> Self
pub fn env<K: AsRef<OsStr>, V: AsRef<OsStr>>(self, env: K, val: V) -> Self
Sets an environment variable
Sourcepub fn output(&self) -> Output
pub fn output(&self) -> Output
Run the command and return it’s output.
This is convienece method for calling std::process::Command::output()
method on command
instance retrieved by command
method
Sourcepub fn run(&self)
pub fn run(&self)
Run the command and exit the build with informative panic message if execution fails.
This is convienece method for calling std::process::Command::status()
method on command
instance retrieved by command
method
Sourcepub fn run_result(&self) -> Result<ExitStatus>
pub fn run_result(&self) -> Result<ExitStatus>
Run the command and return it’s status.
This is convienece method for calling std::process::Command::status()
method on command
instance retrieved by command
method