pub struct CheckedCommand { /* private fields */ }Expand description
A wrapper around std::process::Command
which hides the original status/output methods
and replaces them with the versions from checked_command::CommandExt
Implementations§
Source§impl CheckedCommand
impl CheckedCommand
Sourcepub fn as_std_command(&mut self) -> &mut Command
pub fn as_std_command(&mut self) -> &mut Command
return a mutable reference to the wrapped std::process::Command
this can be useful if the cammand has to be passed to a function
or to access a extension trait for std::process::Command
Sourcepub fn into_std_command(self) -> Command
pub fn into_std_command(self) -> Command
converts this Command into a std::process::Command
(basically unwrapping it).
Note that this function was intentionally provided instead
of Into<Command> as the main reason for this wrapper is
to prevent forgetting to check the exit status. As such it
will forward all calls except spawn,status and output
which normally tend to be the last function ever called on
a command instances. Therefore converting a CheckedCommand
to a Command is quite likely a bug. (Through there are some
cases where it makes sense).
Sourcepub fn new<S: AsRef<OsStr>>(program: S) -> CheckedCommand
pub fn new<S: AsRef<OsStr>>(program: S) -> CheckedCommand
creates a new CheckedCommand
see std::process:Command::new for more details
Sourcepub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut CheckedCommand
pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut CheckedCommand
calls std::process::Command::arg
Sourcepub fn args<I, S>(&mut self, args: I) -> &mut CheckedCommand
pub fn args<I, S>(&mut self, args: I) -> &mut CheckedCommand
calls std::process::Command::args
Sourcepub fn env<K, V>(&mut self, key: K, val: V) -> &mut CheckedCommand
pub fn env<K, V>(&mut self, key: K, val: V) -> &mut CheckedCommand
calls std::process::Command::env
Sourcepub fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut CheckedCommand
pub fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut CheckedCommand
calls std::process::Command::env_remove
Sourcepub fn env_clear(&mut self) -> &mut CheckedCommand
pub fn env_clear(&mut self) -> &mut CheckedCommand
calls std::process::Command::env_clear
Sourcepub fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut CheckedCommand
pub fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut CheckedCommand
calls std::process::Command::current_dir
Sourcepub fn stdin(&mut self, cfg: Stdio) -> &mut CheckedCommand
pub fn stdin(&mut self, cfg: Stdio) -> &mut CheckedCommand
calls std::process::Command::stdin
Sourcepub fn stdout(&mut self, cfg: Stdio) -> &mut CheckedCommand
pub fn stdout(&mut self, cfg: Stdio) -> &mut CheckedCommand
calls std::process::Command::stdout
Sourcepub fn stderr(&mut self, cfg: Stdio) -> &mut CheckedCommand
pub fn stderr(&mut self, cfg: Stdio) -> &mut CheckedCommand
calls std::process::Command::stderr
Sourcepub fn spawn(&mut self) -> Result<CheckedChild, IoError>
pub fn spawn(&mut self) -> Result<CheckedChild, IoError>
calls std::process::Command::spawn and converts the
Child into a CheckedChild