Skip to main content

ProcessSpawner

Trait ProcessSpawner 

Source
pub trait ProcessSpawner: Send + Sync {
    // Required method
    fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        command: &'life1 str,
        args: &'life2 [&'life3 str],
        working_dir: Option<&'life4 Path>,
        timeout_secs: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<ProcessOutput, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

Platform-agnostic process spawner.

Implementations run external commands and capture their output. This is intentionally not part of the super::Platform trait bundle because it is unavailable in WASM environments.

Required Methods§

Source

fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, command: &'life1 str, args: &'life2 [&'life3 str], working_dir: Option<&'life4 Path>, timeout_secs: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<ProcessOutput, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Run a command with arguments and capture its output.

§Arguments
  • command - The executable to run.
  • args - Command-line arguments.
  • working_dir - Optional working directory for the process.
  • timeout_secs - Optional timeout in seconds. If the process exceeds this duration, it will be killed and an error returned.

Implementors§