pub trait CommandRunExt {
// Required methods
fn log_debug(&mut self) -> &mut Self;
fn run_inherited(&mut self) -> Result<()>;
fn run_capture_stderr(&mut self) -> Result<()>;
fn run_inherited_with_cmd_context(&mut self) -> Result<()>;
fn lifecycle_bind(&mut self) -> &mut Self;
fn run_get_output(&mut self) -> Result<Box<dyn BufRead>>;
fn run_get_string(&mut self) -> Result<String>;
fn run_and_parse_json<T: DeserializeOwned>(&mut self) -> Result<T>;
fn to_string_pretty(&self) -> String;
}Expand description
Helpers intended for std::process::Command.
Required Methods§
Sourcefn run_inherited(&mut self) -> Result<()>
fn run_inherited(&mut self) -> Result<()>
Sourcefn run_capture_stderr(&mut self) -> Result<()>
fn run_capture_stderr(&mut self) -> Result<()>
Sourcefn run_inherited_with_cmd_context(&mut self) -> Result<()>
fn run_inherited_with_cmd_context(&mut self) -> Result<()>
Sourcefn lifecycle_bind(&mut self) -> &mut Self
fn lifecycle_bind(&mut self) -> &mut Self
Ensure the child does not outlive the parent.
Sourcefn run_get_output(&mut self) -> Result<Box<dyn BufRead>>
fn run_get_output(&mut self) -> Result<Box<dyn BufRead>>
Execute the child process and capture its output. This uses run_capture_stderr internally
and will return an error if the child process exits abnormally.
Sourcefn run_get_string(&mut self) -> Result<String>
fn run_get_string(&mut self) -> Result<String>
Execute the child process and capture its output as a string.
This uses run_capture_stderr internally.
Sourcefn run_and_parse_json<T: DeserializeOwned>(&mut self) -> Result<T>
fn run_and_parse_json<T: DeserializeOwned>(&mut self) -> Result<T>
Execute the child process, parsing its stdout as JSON. This uses run_capture_stderr internally
and will return an error if the child process exits abnormally.
Sourcefn to_string_pretty(&self) -> String
fn to_string_pretty(&self) -> String
Print the command as it would be typed into a terminal
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl CommandRunExt for Command
impl CommandRunExt for Command
Source§fn run_capture_stderr(&mut self) -> Result<()>
fn run_capture_stderr(&mut self) -> Result<()>
Synchronously execute the child, and return an error if the child exited unsuccessfully.
Source§fn run_and_parse_json<T: DeserializeOwned>(&mut self) -> Result<T>
fn run_and_parse_json<T: DeserializeOwned>(&mut self) -> Result<T>
Synchronously execute the child, and parse its stdout as JSON.