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>;
// Provided methods
fn run_command_streaming(
&self,
cmd: &str,
args: &[&str],
on_output: &dyn Fn(&str),
) -> Result<Vec<u8>, BntoError> { ... }
fn home_dir(&self) -> Option<&Path> { ... }
fn output_dir(&self) -> Option<PathBuf> { ... }
}Expand description
System access boundary for processors that need external tools.
Required Methods§
Sourcefn run_command(&self, cmd: &str, args: &[&str]) -> Result<Vec<u8>, BntoError>
fn run_command(&self, cmd: &str, args: &[&str]) -> Result<Vec<u8>, BntoError>
Run an external command, capturing stdout.
Provided Methods§
Sourcefn run_command_streaming(
&self,
cmd: &str,
args: &[&str],
on_output: &dyn Fn(&str),
) -> Result<Vec<u8>, BntoError>
fn run_command_streaming( &self, cmd: &str, args: &[&str], on_output: &dyn Fn(&str), ) -> Result<Vec<u8>, BntoError>
Run an external command, streaming output lines via a callback.
Calls on_output for each line of stdout and stderr as it arrives,
enabling live progress feedback from tools like yt-dlp.
Returns stdout bytes on success. Default falls back to run_command().
Sourcefn home_dir(&self) -> Option<&Path>
fn home_dir(&self) -> Option<&Path>
Get the bnto home directory (~/.bnto/ by default).
Returns None in browser (WASM) — filesystem paths don’t apply.
Sourcefn output_dir(&self) -> Option<PathBuf>
fn output_dir(&self) -> Option<PathBuf>
Get the default output directory for recipe results (~/.bnto/output/).
Returns None in browser (WASM) — filesystem paths don’t apply.