Skip to main content

ActionExecutor

Trait ActionExecutor 

Source
pub trait ActionExecutor: Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        spec: &'life1 ActionSpec,
    ) -> Pin<Box<dyn Future<Output = Result<ExecutionOutput, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn execute_with_progress<'life0, 'life1, 'async_trait>(
        &'life0 self,
        spec: &'life1 ActionSpec,
        progress: UnboundedSender<String>,
    ) -> Pin<Box<dyn Future<Output = Result<ExecutionOutput, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Abstraction over action execution, making the execute + rollback path testable without spawning real OS commands.

The production implementation (RealActionExecutor) delegates to tokio::process::Command. Tests can inject a mock that controls exit codes and output per program.

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 ActionSpec, ) -> Pin<Box<dyn Future<Output = Result<ExecutionOutput, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute an ActionSpec and return its output.

Provided Methods§

Source

fn execute_with_progress<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 ActionSpec, progress: UnboundedSender<String>, ) -> Pin<Box<dyn Future<Output = Result<ExecutionOutput, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute an action and publish stdout lines while it runs.

Test doubles normally implement only execute; this default forwards their captured output after completion. Production overrides the method so command output remains live.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§