Skip to main content

LlmSpawnBackend

Trait LlmSpawnBackend 

Source
pub trait LlmSpawnBackend: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn default_binary_name(&self) -> &'static str;

    // Provided methods
    fn resolve_binary(
        &self,
        override_path: Option<&Path>,
    ) -> Result<PathBuf, AppError> { ... }
    fn spawn_child(&self, cmd: &mut Command) -> Result<Child> { ... }
}
Expand description

Common surface for LLM CLI spawn adapters (claude, codex, …).

Implementations resolve the backend binary and spawn a prepared Command. Argument construction and stdout parsing remain outside this trait (see super::VersionAdapter for version/flag adaptation).

Required Methods§

Source

fn name(&self) -> &'static str

Logical backend name (e.g. "claude", "codex").

Source

fn default_binary_name(&self) -> &'static str

Default binary basename looked up on PATH when no override is set.

Provided Methods§

Source

fn resolve_binary( &self, override_path: Option<&Path>, ) -> Result<PathBuf, AppError>

Resolve the executable path, honouring an optional absolute/relative override.

§Errors

Returns AppError::BinaryNotFound when neither the override nor the default basename can be located via which.

Source

fn spawn_child(&self, cmd: &mut Command) -> Result<Child>

Spawn a prepared command under the shared process policy.

Default implementation uses plain Command::spawn. Call sites that need setsid / RLIMIT_AS should continue to use commands::claude_runner::spawn_with_memory_limit until that helper is relocated into this module (follow-up).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§