Skip to main content

ProcessManager

Trait ProcessManager 

Source
pub trait ProcessManager:
    Clone
    + Send
    + 'static {
    type Handle: BackgroundHandle + Clone + Send + 'static;

    // Required method
    fn run_command(
        &mut self,
        ctx: &CommandContext,
        script: &str,
        options: CommandOptions,
    ) -> Result<CommandResult<Self::Handle>>;

    // Provided methods
    fn spawn_command(
        &mut self,
        ctx: &CommandContext,
        script: &str,
        options: CommandOptions,
    ) -> Result<CommandResult<Self::Handle>> { ... }
    fn run_argv(
        &mut self,
        _ctx: &CommandContext,
        argv: &[String],
        _options: CommandOptions,
    ) -> Result<CommandResult<Self::Handle>> { ... }
    fn spawn_argv(
        &mut self,
        ctx: &CommandContext,
        argv: &[String],
        options: CommandOptions,
    ) -> Result<CommandResult<Self::Handle>> { ... }
}
Expand description

Abstraction for running shell commands both in the foreground and background. oxdock-core relies on this trait to decouple the executor from std::process::Command, which in turn enables Miri-friendly test doubles.

Required Associated Types§

Required Methods§

Source

fn run_command( &mut self, ctx: &CommandContext, script: &str, options: CommandOptions, ) -> Result<CommandResult<Self::Handle>>

Provided Methods§

Source

fn spawn_command( &mut self, ctx: &CommandContext, script: &str, options: CommandOptions, ) -> Result<CommandResult<Self::Handle>>

Spawn a command without waiting for completion. Returns a background handle that can be polled or waited on later. The default implementation delegates to run_command with CommandMode::Background.

Source

fn run_argv( &mut self, _ctx: &CommandContext, argv: &[String], _options: CommandOptions, ) -> Result<CommandResult<Self::Handle>>

Run an executable directly with an argument vector (no shell). Backs the RUN ["exe", "arg", ...] exec form. The default implementation bails so existing out-of-tree managers keep compiling; in-tree managers override this.

Source

fn spawn_argv( &mut self, ctx: &CommandContext, argv: &[String], options: CommandOptions, ) -> Result<CommandResult<Self::Handle>>

Spawn an argv command without waiting for completion. The default implementation delegates to run_argv, mirroring spawn_command.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§