Skip to main content

ProcessContext

Trait ProcessContext 

Source
pub trait ProcessContext: Send + Sync {
    // Required methods
    fn run_command(
        &self,
        cmd: &str,
        args: &[&str],
    ) -> Result<Vec<u8>, BntoError>;
    fn temp_file(&self, suffix: &str) -> Result<PathBuf, BntoError>;
    fn env_var(&self, key: &str) -> Option<String>;
    fn work_dir(&self) -> Result<&Path, BntoError>;
}
Expand description

System access boundary for processors that need external tools.

Required Methods§

Source

fn run_command(&self, cmd: &str, args: &[&str]) -> Result<Vec<u8>, BntoError>

Run an external command, capturing stdout.

Source

fn temp_file(&self, suffix: &str) -> Result<PathBuf, BntoError>

Return a unique temporary file path. The file is NOT pre-created — the caller (or external tool) is responsible for writing to it.

Source

fn env_var(&self, key: &str) -> Option<String>

Read an environment variable.

Source

fn work_dir(&self) -> Result<&Path, BntoError>

Get the working directory for this execution.

Implementors§