-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ExitCode::exit_process() method #95356
Conversation
r? @yaahc (rust-highfive has picked a reviewer for you, use r? to override) |
96a75a3
to
34cc4e7
Compare
Made #95389, I'll rebase onto that. |
34cc4e7
to
9a435ac
Compare
9a435ac
to
254a1b5
Compare
254a1b5
to
9130fe5
Compare
Also was wondering about an examples section; I'm not sure what a good sample use-case would be that wouldn't just be better served by a panic, my current idea is: use std::process::Termination;
fn unwrap_or_exit<T, E: Debug>(res: Result<T, E>) -> T {
match res {
Ok(v) => v,
Err(e) => {
eprintln!("very fatal error:");
Err::<Infallible, _>(e).report().exit_process()
}
}
} But eehhhh. Do you have any ideas, or is it fine without? |
But that's probably involved with the whole "what to do with process::exit() now" general question. |
9130fe5
to
5211cb7
Compare
5211cb7
to
8ff0fd1
Compare
Pushed a change to the |
I like the snippet inside of the example but yea, unwrap_or_exit is questionable. It's getting late so I didn't dig into this too deeply but my thought was to look at examples of ppl using https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Arust+process%3A%3Aexit |
@coolreader18 if you can update this with the latest changes as per the last comment we can push this forward |
This comment has been minimized.
This comment has been minimized.
75e13ef
to
8152d0e
Compare
This comment has been minimized.
This comment has been minimized.
this LGTM once the todo is fixed. After you've fixed that up and it's passing the github checks go ahead and r=me @bors delegate+ |
✌️ @coolreader18 can now approve this pull request |
8152d0e
to
a9e29d2
Compare
ah shoot I told bors to try but I don't think that's what you meant, hopefully that's fine |
did you delete the comment after? I don't see a bors command anywhere. The correct command should be |
ha, yeah, I did delete it cause I thought maybe it would cancel it. anyway, |
📌 Commit a9e29d2 has been approved by |
One day I'll stop overthinking whether I'm using bors correctly, but I guess that's not today 🙃 |
☀️ Test successful - checks-actions |
I use saved replies to help me with this, lol, and even then I often end up being confused, which reminds me, I meant to add a new saved reply for bors delegate, I had to look that up before #95356 (comment) |
Finished benchmarking commit (9ad4bde): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
@coolreader18 I just realized I forgot an important step of the process. This method needs a tracking issue. Can you set one up and submit another PR to update the issue field to point to the new tracking issue? |
cc @yaahc / #93840
(eeek, hit ctrl-enter before I meant to and right after realizing the branch name was wrong. oh, well)
I feel like it makes sense to have the
exit(ExitCode)
function as a method or at least associated function on ExitCode, but maybe that would hurt discoverability? Probably not as much if it's at the top of theprocess::exit()
documentation or something, but idk. Also very unsure about the name, I'd like something that communicates that you are exiting with this ExitCode, but with a method name being postfix it doesn't seem to flow.code.exit_process_with()
?.exit_process_with_self()
? Blech. Maybe it doesn't matter, since ideally justcode.exit()
or something would be clear simply by the name and single parameter but 🤷Also I'd like to touch up the
ExitCode
docs (which I did a bit here), but that would probably be good in a separate PR, right? Since I think the beta deadline is coming up.