Skip to main content

LinuxEnv

Trait LinuxEnv 

Source
pub trait LinuxEnv: Send + Sync {
    // Required methods
    fn run(&self, script: &str) -> Result<Output>;
    fn run_visible(&self, script: &str) -> Result<()>;
    fn run_stdout(&self, script: &str) -> Result<String>;
    fn run_capture(&self, script: &str) -> Result<Output>;
}
Expand description

Abstraction for running Linux commands.

On macOS: delegates to a Lima VM via limactl shell. On native Linux with KVM: runs bash directly on the host. In the future: could route to OrbStack, UTM, or a remote host.

This trait decouples the “where scripts run” question from the rest of the codebase. All VM lifecycle, build, and networking code can accept a &dyn LinuxEnv instead of hardcoding Lima.

Required Methods§

Source

fn run(&self, script: &str) -> Result<Output>

Run a bash script, capturing output.

Source

fn run_visible(&self, script: &str) -> Result<()>

Run a bash script with output visible to the user (inherited stdio).

Source

fn run_stdout(&self, script: &str) -> Result<String>

Run a bash script and return stdout as a trimmed String.

Source

fn run_capture(&self, script: &str) -> Result<Output>

Run a bash script, capturing both stdout and stderr (piped, not inherited).

Implementors§