Skip to content

call to os::args() suppresses nonzero exit code & "root task failed" line #5383

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

Closed
jbclements opened this issue Mar 14, 2013 · 4 comments
Closed
Labels
A-codegen Area: Code generation A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Milestone

Comments

@jbclements
Copy link
Contributor

The following program calls 'fail!()', but still results in an exit code of zero:

fn main () {
    os::args();
    fail!();
}

Here's what it looks like:

jclements-09740:~/clements/projects/rust-experimenting clements> rustc ./foo.rs && ./foo && echo "done" 
Running /usr/local/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
rust: task failed at 'explicit failure', ./foo.rs:3
done

Commenting out the call to "os::args()" produces the expected output:

jclements-09740:~/clements/projects/rust-experimenting clements> rustc ./foo.rs && ./foo && echo "done"
Running /usr/local/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
rust: task failed at 'explicit failure', ./foo.rs:3
rust: domain main @0x7fdd91815e10 root task failed

... note the extra line of output, and the lack of the "done" message, indicating a nonzero exit code.

@jbclements
Copy link
Contributor Author

I've narrowed this further; it's triggered by any call to local_data_get:

fn bogus_key(_v: @uint) {}


pub fn cause_bug()  {
    unsafe {
        task::local_data::local_data_get(bogus_key);
    }
}

fn main () {
    cause_bug();
    fail!();
}

@brson
Copy link
Contributor

brson commented Mar 14, 2013

Looks like a duplicate of #4547. We had a discussion of how to fix this somewhere, but I can't locate it now.

@brson
Copy link
Contributor

brson commented Mar 14, 2013

Discussion is in #5054

@brson
Copy link
Contributor

brson commented Mar 14, 2013

Closing as duplicate.

@brson brson closed this as completed Mar 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

2 participants