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

std::run functions fail after io_error #10754

Closed
klutzy opened this issue Dec 1, 2013 · 0 comments · Fixed by #10936
Closed

std::run functions fail after io_error #10754

klutzy opened this issue Dec 1, 2013 · 0 comments · Fixed by #10936

Comments

@klutzy
Copy link
Contributor

klutzy commented Dec 1, 2013

use std::io;
use std::run;

fn main() {
    io::io_error::cond.trap(|_| {}).inside({
        || {
            let opts = run::ProcessOptions::new();
            let _ = run::Process::new("", [], opts); // io_error
        }
    })
}

Result:

task '<main>' failed at 'called `Option::unwrap()` on a `None` value', C:\home\stone\rust-vanilla\src\libstd\option.rs:135

Similarly std::run::{process_status, process_output} fails if it fails to make new process.

Previously #10654 suggested a potential fix using Result but the patch would sound after #10449 lands.

bors added a commit that referenced this issue Dec 14, 2013
…ap-on-None, r=alexcrichton

The problem was that std::run::Process::new() was unwrap()ing the result
of std::io::process::Process::new(), which returns None in the case
where the io_error condition is raised to signal failure to start the
process.

Have std::run::Process::new() similarly return an Option\<run::Process\>
to reflect the fact that a subprocess might have failed to start. Update
utility functions run::process_status() and run::process_output() to
return Option\<ProcessExit\> and Option\<ProcessOutput\>, respectively.

Various parts of librustc and librustpkg needed to be updated to reflect
these API changes.

closes #10754
@bors bors closed this as completed in 5de4270 Dec 14, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 5, 2024
new lint: `zombie_processes`

Closes rust-lang#10754

Lint description should explain this PR, so I think there's nothing else to say here ^^

changelog: new lint: [`zombie_processes`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant