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

Unwinding panics have wrong exit code #1064

Closed
RalfJung opened this issue Nov 19, 2019 · 1 comment · Fixed by #1065
Closed

Unwinding panics have wrong exit code #1064

RalfJung opened this issue Nov 19, 2019 · 1 comment · Fixed by #1065
Labels
A-panics Area: affects panics and unwinding C-bug Category: This is a bug.

Comments

@RalfJung
Copy link
Member

When a panic=unwind program panics in regular rustc, it has exit code 101. When it panics in Miri, it has exit code 0. That seems wrong, the exit code shouldn't indicate success.

@Aaron1011 why idea where the disparity might come from?

@RalfJung RalfJung added A-panics Area: affects panics and unwinding C-bug Category: This is a bug. labels Nov 19, 2019
@Aaron1011
Copy link
Member

It looks like we don't currently inspect the return value of the start lang item - we only handle explicit calls to std::process::exit

bors added a commit that referenced this issue Nov 20, 2019
Propagate the return code from the `start` lang item

Fixes #1064

This ensures that we set the error code properly when a panic unwinds
past `main`.

I'm not sure what the best way to write a test for this is
@bors bors closed this as completed in 2532b86 Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-panics Area: affects panics and unwinding C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants