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

Tracking Issue for ExitCode::exit_process() #97100

Open
1 of 3 tasks
coolreader18 opened this issue May 17, 2022 · 3 comments
Open
1 of 3 tasks

Tracking Issue for ExitCode::exit_process() #97100

coolreader18 opened this issue May 17, 2022 · 3 comments
Labels
A-process Area: `std::process` and `std::env` C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@coolreader18
Copy link
Contributor

Feature gate: #![feature(exitcode_exit_method)]

This is a tracking issue for the ExitCode::exit_process() method.

exit_code.exit_process() exits the process with the ExitCode passed as the self argument.

Public API

impl std::process::ExitCode {
    pub fn exit_process(self) -> !;
}

Steps / History

Unresolved Questions

  • Name of the method? Might be better to have a free function instead of associated method, but then there's no good name for it that wouldn't overlap with the existing process::exit. As a postfix verb it's sorta clunky, or maybe doesn't communicate explicitly with what the process is being exited? I think exit_process strikes a good balance but I discussed it more in the impl PR ExitCode::exit_process() method #95356.
@coolreader18 coolreader18 added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels May 17, 2022
@ghost
Copy link

ghost commented Oct 31, 2022

Thoughts on naming it something like exit_with?

ExitCode::SUCCESS.exit_with()
// vs
ExitCode::SUCCESS.exit_process()

let code = ExitCode::FAILURE;
code.exit_with()
// vs
code.exit_process()

@ChrisDenton
Copy link
Member

In the standard library, the _with suffix is generally used in functions that take a closure (the exception starts_with and ends_with that take a slice or pattern).

@coolreader18
Copy link
Contributor Author

(and {starts,ends}_with can take a closure if you really want to, Fn(char) -> bool impls Pattern 🙃 )

But yeah, I was thinking about that @h4x5 but the "word order" didn't really make sense, and also the closure thing.

@workingjubilee workingjubilee added the A-process Area: `std::process` and `std::env` label Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-process Area: `std::process` and `std::env` C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants