-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
libtest: Replace panics with error messages #47986
Conversation
r? @Kimundi (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the exit code is correct, but I'm fine with approving this with the small not fixed. We can iterate further later.
src/libtest/lib.rs
Outdated
Err(e) => panic!("io error when running tests: {:?}", e), | ||
Err(e) => { | ||
eprintln!("error: io error when listing tests: {:?}", e); | ||
::std::process::exit(101); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's import std::process
to make these a little cleaner.
0d653f7
to
61ff3ba
Compare
Refactored as you suggested. The error code is the same as what have been used elsewhere in the file; is there some sort of standard? |
Not really. @bors r+ |
📌 Commit 61ff3ba has been approved by |
…lacrum libtest: Replace panics with error messages This replaces explicit panics on failures in libtest with prints to stderr. Where "failures" == CLI argument parsing and such Before: ``` $ ./foo-stable --not-an-option thread 'main' panicked at '"Unrecognized option: \'not-an-option\'"', libtest/lib.rs:251:27 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` After: ``` $ ./foo-nightly --not-an-option error: Unrecognized option: 'not-an-option' ```
This replaces explicit panics on failures in libtest with prints to stderr.
Where "failures" == CLI argument parsing and such
Before:
After: