Trait mmrbi::CommandExt
source · [−]pub trait CommandExt {
fn status0(&mut self) -> Result<()>;
fn output0(&mut self) -> Result<Output>;
fn stdout0(&mut self) -> Result<String>;
fn stdout0_no_stderr(&mut self) -> Result<String>;
fn io(
&mut self,
on_out: impl Fn(&str) + Send + Sync + 'static,
on_err: impl Fn(&str) + Send + Sync + 'static
) -> Result<ExitStatus>;
fn io0(
&mut self,
on_out: impl Fn(&str) + Send + Sync + 'static,
on_err: impl Fn(&str) + Send + Sync + 'static
) -> Result<()>;
}
Expand description
Utility methods for std::process::Command
Required methods
Command::status, but returns an error if the process didn’t have a zero exit code
Command::output, but returns an error if the process didn’t have a zero exit code
Command::output, but:
- Returns an error if the process didn’t have a zero exit code
- Returns an error if stdout wasn’t valid unicode
- Returns only stdout
- Stderr is inherited instead of redirected
fn stdout0_no_stderr(&mut self) -> Result<String>
fn stdout0_no_stderr(&mut self) -> Result<String>
Command::output, but:
- Returns an error if the process didn’t have a zero exit code
- Returns an error if stdout wasn’t valid unicode
- Returns only stdout
- Stderr is nulled instead of redirected
Command::status, but provides a callback for stdout/stderr