We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4f0508a + b10e061 commit d274e55Copy full SHA for d274e55
src/libstd/sys/redox/process.rs
@@ -501,4 +501,18 @@ impl Process {
501
self.status = Some(ExitStatus(status as i32));
502
Ok(ExitStatus(status as i32))
503
}
504
+
505
+ pub fn try_wait(&mut self) -> io::Result<ExitStatus> {
506
+ if let Some(status) = self.status {
507
+ return Ok(status)
508
+ }
509
+ let mut status = 0;
510
+ let pid = cvt(syscall::waitpid(self.pid, &mut status, syscall::WNOHANG))?;
511
+ if pid == 0 {
512
+ Err(io::Error::from_raw_os_error(syscall::EWOULDBLOCK))
513
+ } else {
514
+ self.status = Some(ExitStatus(status as i32));
515
+ Ok(ExitStatus(status as i32))
516
517
518
0 commit comments