pub struct Process { /* private fields */ }Expand description
A handle to a spawned process.
§Fork Safety
The process handle contains a PID. After a fork, the child process will
have a copy of this PID, but it refers to the same original process.
Calling wait or kill from the child may lead to confusing results
if multiple processes are managing the same PID.
Implementations§
Source§impl Process
impl Process
Sourcepub fn wait_step(&self) -> Result<Option<ExitStatus>, CoreError>
pub fn wait_step(&self) -> Result<Option<ExitStatus>, CoreError>
Perform a non-blocking wait for process termination.
§Errors
ECHILD: The process does not exist or is not a child of the caller.EINTR: The call was interrupted by a signal (handled internally).
Sourcepub fn wait_blocking(&self) -> Result<ExitStatus, CoreError>
pub fn wait_blocking(&self) -> Result<ExitStatus, CoreError>
Block until the process terminates.
§Errors
ECHILD: The process does not exist or is not a child of the caller.
Sourcepub fn kill(&self, sig: i32) -> Result<(), CoreError>
pub fn kill(&self, sig: i32) -> Result<(), CoreError>
Send a signal to the process.
§Errors
EINVAL: Invalid signal number.EPERM: The caller does not have permission to send the signal.ESRCH: The process does not exist.
Auto Trait Implementations§
impl Freeze for Process
impl RefUnwindSafe for Process
impl Send for Process
impl Sync for Process
impl Unpin for Process
impl UnsafeUnpin for Process
impl UnwindSafe for Process
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