pub struct ManagedProcess { /* private fields */ }Expand description
Handle for a long-running process started by start_process, such as a
browser.
Dropping the handle asks command-stream to stop the process; call
kill and wait for deterministic cleanup.
Implementations§
Source§impl ManagedProcess
impl ManagedProcess
Sourcepub fn exit_code(&self) -> Option<i32>
pub fn exit_code(&self) -> Option<i32>
Exit code once the process has exited (128 + signal for a signal).
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether the process is still running.
Sourcepub fn on_stdout(&self, listener: OutputListener)
pub fn on_stdout(&self, listener: OutputListener)
Register another stdout listener. Output already delivered is not
replayed; pass listeners in StartProcessOptions to see everything.
Sourcepub fn on_stderr(&self, listener: OutputListener)
pub fn on_stderr(&self, listener: OutputListener)
Register another stderr listener. Output already delivered is not
replayed; pass listeners in StartProcessOptions to see everything.
Sourcepub fn kill(&self) -> bool
pub fn kill(&self) -> bool
Stop the process with SIGTERM, then SIGKILL after the grace period.
Returns whether a running process was signalled.
Sourcepub fn kill_with(&self, signal: &str) -> bool
pub fn kill_with(&self, signal: &str) -> bool
Stop the process with an explicit signal name, then SIGKILL after the
grace period. Returns whether a running process was signalled.
Sourcepub async fn wait_timeout(&self, timeout: Duration) -> Option<i32>
pub async fn wait_timeout(&self, timeout: Duration) -> Option<i32>
Wait up to timeout for the process to exit; None if it is still
running afterwards.
Trait Implementations§
Source§impl Debug for ManagedProcess
impl Debug for ManagedProcess
Source§impl Drop for ManagedProcess
impl Drop for ManagedProcess
Auto Trait Implementations§
impl !RefUnwindSafe for ManagedProcess
impl !UnwindSafe for ManagedProcess
impl Freeze for ManagedProcess
impl Send for ManagedProcess
impl Sync for ManagedProcess
impl Unpin for ManagedProcess
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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 more