pub trait ProcessSpawner: Send + Sync {
// Required method
fn spawn<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn spawn_to_file<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
stdout_to: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn spawn_cancellable<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
stdout_to: Option<PathBuf>,
_kill_rx: Receiver<()>,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for spawning processes (local or remote)
This abstraction allows plugins and core features (like file discovery) to spawn processes transparently on either local or remote filesystems.
Required Methods§
Provided Methods§
Sourcefn spawn_to_file<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
stdout_to: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_to_file<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
stdout_to: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Spawn a process, piping stdout directly to a file instead of buffering it in memory. Default impl buffers and writes; concrete implementations should override when a streaming path exists.
SpawnResult.stdout is empty on success — the bytes are on disk
at stdout_to instead. stderr and exit_code work as usual.
Sourcefn spawn_cancellable<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
stdout_to: Option<PathBuf>,
_kill_rx: Receiver<()>,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_cancellable<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
cwd: Option<String>,
stdout_to: Option<PathBuf>,
_kill_rx: Receiver<()>,
) -> Pin<Box<dyn Future<Output = Result<SpawnResult, SpawnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Spawn a process that can be cancelled mid-flight via a oneshot
receiver. When stdout_to is Some, stdout streams to the file;
when None, it’s buffered into SpawnResult.stdout.
If kill_rx fires before the child exits, the child is killed and
the result reflects the killed exit status.
Default impl ignores kill_rx (no true cancellation for backends
that buffer in memory). Local override implements real kill.