fn poll()

in reverie-process/src/child.rs [247:263]


    fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
        loop {
            // Register an interest in SIGCHLD signals. We can't just call
            // `try_wait` right away. We might miss a signal event if the child
            // hasn't exited yet. Thus, we poll the signal stream to tell Tokio
            // we're interested in signal events.
            let sig = self.signal.poll_recv(cx);

            if let Some(status) = self.child.try_wait()? {
                return Poll::Ready(Ok(status));
            }

            if sig.is_pending() {
                return Poll::Pending;
            }
        }
    }