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 method
fn spawn_command(
&mut self,
ctx: &CommandContext,
script: &str,
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§
type Handle: BackgroundHandle + Clone + Send + 'static
Required Methods§
fn run_command( &mut self, ctx: &CommandContext, script: &str, options: CommandOptions, ) -> Result<CommandResult<Self::Handle>>
Provided Methods§
Sourcefn spawn_command(
&mut self,
ctx: &CommandContext,
script: &str,
options: CommandOptions,
) -> Result<CommandResult<Self::Handle>>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".