pub struct ProcessManager { /* private fields */ }Expand description
Manager for background shell processes.
Implementations§
Source§impl ProcessManager
impl ProcessManager
Sourcepub async fn spawn(
&self,
command: &str,
working_dir: &Path,
) -> Result<ProcessId, String>
pub async fn spawn( &self, command: &str, working_dir: &Path, ) -> Result<ProcessId, String>
Spawn a new background process.
Sourcepub async fn spawn_with_env(
&self,
command: &str,
working_dir: &Path,
env: SanitizedEnv,
) -> Result<ProcessId, String>
pub async fn spawn_with_env( &self, command: &str, working_dir: &Path, env: SanitizedEnv, ) -> Result<ProcessId, String>
Spawn a new background process with custom sanitized environment.
Sourcepub async fn kill(&self, id: &ProcessId) -> Result<(), String>
pub async fn kill(&self, id: &ProcessId) -> Result<(), String>
Kill a background process and wait to reap it (prevents zombie).
Sourcepub async fn get_output(&self, id: &ProcessId) -> Result<String, String>
pub async fn get_output(&self, id: &ProcessId) -> Result<String, String>
Get output from a background process (non-blocking read of available output).
Sourcepub async fn is_running(&self, id: &ProcessId) -> bool
pub async fn is_running(&self, id: &ProcessId) -> bool
Check if a process is still running.
Sourcepub async fn list(&self) -> Vec<ProcessInfo>
pub async fn list(&self) -> Vec<ProcessInfo>
List all tracked processes.
Sourcepub async fn cleanup_finished(&self) -> Vec<(ProcessInfo, String)>
pub async fn cleanup_finished(&self) -> Vec<(ProcessInfo, String)>
Clean up finished processes and return their final output.
Trait Implementations§
Source§impl Clone for ProcessManager
impl Clone for ProcessManager
Source§fn clone(&self) -> ProcessManager
fn clone(&self) -> ProcessManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProcessManager
impl !RefUnwindSafe for ProcessManager
impl Send for ProcessManager
impl Sync for ProcessManager
impl Unpin for ProcessManager
impl !UnwindSafe for ProcessManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.