Skip to main content

ShellExecutor

Trait ShellExecutor 

Source
pub trait ShellExecutor: Send + Sync {
    // Required method
    fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        command: &'life1 str,
        cwd: &'life2 Path,
        timeout: Duration,
        cancelled: &'life3 AtomicBool,
        progress: &'life4 mut (dyn for<'a> FnMut(&'a str) + Send),
    ) -> Pin<Box<dyn Future<Output = Result<Executed, ShellError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

Runs shell commands for the bash tool.

Required Methods§

Source

fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, command: &'life1 str, cwd: &'life2 Path, timeout: Duration, cancelled: &'life3 AtomicBool, progress: &'life4 mut (dyn for<'a> FnMut(&'a str) + Send), ) -> Pin<Box<dyn Future<Output = Result<Executed, ShellError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Runs command with bash -c and cwd as working directory, streaming complete output lines through progress as they land and returning what the command left behind. A command outliving timeout is killed and reported as ShellError::Timeout; a flip of cancelled mid-run stops the run with ShellError::Cancelled. Implementations must not panic and must not abort: every failure comes back as a ShellError.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§