pub struct ManagedProcess { /* private fields */ }Expand description
A managed child process with automatic cleanup on drop.
When a ManagedProcess is dropped, it will:
- Send SIGTERM (Unix) or terminate (Windows) to the process
- Wait for the process to exit
This ensures no orphaned processes are left behind.
Implementations§
Source§impl ManagedProcess
impl ManagedProcess
Sourcepub fn role(&self) -> ProcessRole
pub fn role(&self) -> ProcessRole
Returns the role of this process.
Sourcepub fn binary_name(&self) -> &str
pub fn binary_name(&self) -> &str
Returns the binary name (for logging).
Sourcepub fn child_mut(&mut self) -> &mut Child
pub fn child_mut(&mut self) -> &mut Child
Returns a mutable reference to the underlying child process.
Sourcepub fn wait(&mut self) -> Result<ExitStatus>
pub fn wait(&mut self) -> Result<ExitStatus>
Waits for the process to exit and returns the exit status.
Sourcepub fn try_wait(&mut self) -> Result<Option<ExitStatus>>
pub fn try_wait(&mut self) -> Result<Option<ExitStatus>>
Checks if the process has exited.
Trait Implementations§
Source§impl Debug for ManagedProcess
impl Debug for ManagedProcess
Auto Trait Implementations§
impl Freeze for ManagedProcess
impl RefUnwindSafe for ManagedProcess
impl Send for ManagedProcess
impl Sync for ManagedProcess
impl Unpin for ManagedProcess
impl UnwindSafe for ManagedProcess
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