Skip to content

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

Closed
@jbclements

Description

@jbclements

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions