pub struct RecordingRunner<R: ProcessRunner = ScriptedRunner> { /* private fields */ }Expand description
Wraps another ProcessRunner, recording every Invocation before
delegating, so tests can assert exactly what was run.
Implementations§
Source§impl<R: ProcessRunner> RecordingRunner<R>
impl<R: ProcessRunner> RecordingRunner<R>
Sourcepub fn calls(&self) -> Vec<Invocation>
pub fn calls(&self) -> Vec<Invocation>
A snapshot of every recorded invocation, in order.
Sourcepub fn only_call(&self) -> Invocation
pub fn only_call(&self) -> Invocation
The single recorded invocation; panics unless exactly one was made.
Trait Implementations§
Source§impl<R: ProcessRunner> Debug for RecordingRunner<R>
impl<R: ProcessRunner> Debug for RecordingRunner<R>
Source§impl<R: ProcessRunner> ProcessRunner for RecordingRunner<R>
impl<R: ProcessRunner> ProcessRunner for RecordingRunner<R>
Source§fn output<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn output<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run
command to completion, capturing stdout/stderr and the exit code.
A non-zero exit is reported in the result, not raised.Source§fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<RunningProcess>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<RunningProcess>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start
command and return a live RunningProcess for streaming,
readiness probes, or incremental consumption. Read moreAuto Trait Implementations§
impl<R = ScriptedRunner> !Freeze for RecordingRunner<R>
impl<R> RefUnwindSafe for RecordingRunner<R>where
R: RefUnwindSafe,
impl<R> Send for RecordingRunner<R>
impl<R> Sync for RecordingRunner<R>
impl<R> Unpin for RecordingRunner<R>where
R: Unpin,
impl<R> UnsafeUnpin for RecordingRunner<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for RecordingRunner<R>where
R: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ProcessRunnerExt for Twhere
T: ProcessRunner + ?Sized,
impl<T> ProcessRunnerExt for Twhere
T: ProcessRunner + ?Sized,
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run, require a zero exit, and return trimmed stdout.
Source§fn run_unit<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_unit<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run for the side effect: require a zero exit, discard the output.
Source§fn exit_code<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<i32>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exit_code<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<i32>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run and return just the exit code. A run that produced no code surfaces as
an error — a timeout as
Error::Timeout, a
signal-kill as an IO error — rather than a synthetic sentinel, mirroring
ensure_success.Source§fn probe<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn probe<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run a predicate command and read its exit code as a boolean: exit
0 →
Ok(true), exit 1 → Ok(false), anything else → Err (other code as
Error::Exit, timeout as
Error::Timeout, signal-kill as an IO error). For
commands whose exit code is the answer — git diff --quiet, grep -q, …Source§fn checked<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn checked<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 Command,
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run, require a zero exit, and return the full captured result (untrimmed
stdout). The building block for the
parse/try_parse helpers — use it
when you need the whole ProcessResult after success-checking, rather
than just trimmed stdout (run) or the raw result (output).