pub struct InvokeResult {
pub exit_code: i32,
pub output: String,
pub stderr: String,
pub exception_message: Option<String>,
}Expand description
The result of invoking a command through CliRunner.
Contains the exit code, captured output, and any exception that occurred.
Fields§
§exit_code: i32The exit code from the command (0 for success).
output: StringCaptured stdout (and stderr if mix_stderr is true).
stderr: StringCaptured stderr (always captured, even if mixed into output).
exception_message: Option<String>The error message if an exception occurred.
Implementations§
Source§impl InvokeResult
impl InvokeResult
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the command succeeded (exit code 0).
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Check if the command failed (exit code != 0).
Sourcepub fn output_lines(&self) -> Vec<&str>
pub fn output_lines(&self) -> Vec<&str>
Get the output lines.
Sourcepub fn output_contains(&self, substring: &str) -> bool
pub fn output_contains(&self, substring: &str) -> bool
Check if the output contains a substring.
Sourcepub fn stderr_contains(&self, substring: &str) -> bool
pub fn stderr_contains(&self, substring: &str) -> bool
Check if the stderr contains a substring.
Sourcepub fn combined_output(&self) -> String
pub fn combined_output(&self) -> String
Get the combined output (stdout + stderr).
If mix_stderr was true, this is the same as output.
Trait Implementations§
Source§impl Clone for InvokeResult
impl Clone for InvokeResult
Source§fn clone(&self) -> InvokeResult
fn clone(&self) -> InvokeResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InvokeResult
impl RefUnwindSafe for InvokeResult
impl Send for InvokeResult
impl Sync for InvokeResult
impl Unpin for InvokeResult
impl UnsafeUnpin for InvokeResult
impl UnwindSafe for InvokeResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more