Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make Child::try_wait return io::Result<Option<ExitStatus>> #39512

Merged
merged 1 commit into from
Feb 8, 2017

Commits on Feb 7, 2017

  1. make Child::try_wait return io::Result<Option<ExitStatus>>

    This is much nicer for callers who want to short-circuit real I/O errors
    with `?`, because they can write this
    
        if let Some(status) = foo.try_wait()? {
            ...
        } else {
            ...
        }
    
    instead of this
    
        match foo.try_wait() {
            Ok(status) => {
                ...
            }
            Err(err) if err.kind() == io::ErrorKind::WouldBlock => {
                ...
            }
            Err(err) => return Err(err),
        }
    
    The original design of `try_wait` was patterned after the `Read` and
    `Write` traits, which support both blocking and non-blocking
    implementations in a single API. But since `try_wait` is never blocking,
    it makes sense to optimize for the non-blocking case.
    
    Tracking issue: rust-lang#38903
    oconnor663 committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    2a345bb View commit details
    Browse the repository at this point in the history