Skip to main content

Executor

Trait Executor 

Source
pub trait Executor {
    // Required method
    fn execute(
        &mut self,
        pipeline: &Pipeline,
        scope: &mut Scope,
    ) -> EvalResult<ExecResult>;

    // Provided method
    fn file_stat(&self, path: &Path) -> Option<DirEntry> { ... }
}
Expand description

Trait for executing pipelines (command substitution).

This is implemented by higher layers (L6: Pipes & Jobs) to provide actual command execution. The evaluator calls this when it encounters a $(pipeline) expression.

Required Methods§

Source

fn execute( &mut self, pipeline: &Pipeline, scope: &mut Scope, ) -> EvalResult<ExecResult>

Execute a pipeline and return its result.

The executor should:

  1. Parse and execute the pipeline
  2. Capture stdout/stderr
  3. Return an ExecResult with code, output, and parsed data

Provided Methods§

Source

fn file_stat(&self, path: &Path) -> Option<DirEntry>

Stat a file path through the VFS.

Returns Some(entry) if the path exists, None otherwise. Used by [[ -d path ]], [[ -f path ]], etc.

Default: falls back to std::fs::metadata (bypasses VFS).

Implementors§