Skip to main content

CommandRunner

Trait CommandRunner 

Source
pub trait CommandRunner: Send + Sync {
    // Required method
    fn run(
        &self,
        request: CommandRequest,
        cancel: CancellationToken,
    ) -> impl Future<Output = Result<CommandResult, ExecError>> + Send;
}
Expand description

Trait for running commands. Implementations must be Send + Sync for use across async tasks.

Required Methods§

Source

fn run( &self, request: CommandRequest, cancel: CancellationToken, ) -> impl Future<Output = Result<CommandResult, ExecError>> + Send

Execute a command to completion, streaming output as it arrives.

The runner should:

  1. Transition the command through CmdQueued → CmdStarted → CmdStreaming → terminal.
  2. Capture stdout/stderr as StreamChunks.
  3. Respect the cancellation token for graceful shutdown.
  4. Apply timeout if configured.

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.

Implementors§