pub struct HostProcess { /* private fields */ }Expand description
A running program and its process group.
§Limits
- A descendant can leave the group, for example with
setsid. Signals no longer reach it. Dropdoes not run if the owning process is killed with SIGKILL, so a program may outlive it.- The OS may reuse the ID of an empty group before it is signalled, which would signal an unrelated group.
Implementations§
Source§impl HostProcess
impl HostProcess
Sourcepub fn spawn(
command: HostCommand,
) -> Result<(Self, OutputStream, ExitWatch), GenericError>
pub fn spawn( command: HostCommand, ) -> Result<(Self, OutputStream, ExitWatch), GenericError>
Starts command in a new process group.
Returns the process, its output, and the watch of its exit.
§Errors
Returns an error if the program cannot be started.
Sourcepub async fn stop(self, grace: Duration) -> Result<(), GenericError>
pub async fn stop(self, grace: Duration) -> Result<(), GenericError>
Stops the process and its group: SIGTERM, then SIGKILL after grace, then up to two seconds for the exit and
for the group to have no live member. A zombie left in the group does not count.
Whatever is left in the group is killed even when the program itself exited. Dropping the future before the SIGKILL drops the process, which sends SIGKILL.
§Errors
Returns an error if the process has not exited, or its group still has a live member, after the SIGKILL. A process on a target with no process groups is not signalled, and stopping it does nothing.
Trait Implementations§
Source§impl Debug for HostProcess
impl Debug for HostProcess
Auto Trait Implementations§
impl Freeze for HostProcess
impl RefUnwindSafe for HostProcess
impl Send for HostProcess
impl Sync for HostProcess
impl Unpin for HostProcess
impl UnsafeUnpin for HostProcess
impl UnwindSafe for HostProcess
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