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

Change the return type of the main function #865

Merged
merged 1 commit into from Jun 13, 2022

Conversation

sorairolake
Copy link
Contributor

@sorairolake sorairolake commented Jun 13, 2022

Since Rust 1.61.0, the main function can return a type that implements the Termination trait. By this, the main function can return custom exit codes, so use this.

This replaces std::process::exit(). Also, using std::process::ExitCode for the return type, considering the possibility of using the own exit code.

Also, I am replacing exitcode with sysexits for return the system exit code constants as defined by <sysexits.h> from the main function.

ref: Announcing Rust 1.61.0

Since Rust 1.61.0, the `main` function can return a type that
implements the `Termination` trait.
By this, the `main` function can return custom exit codes, so use this.
@zonyitoo zonyitoo merged commit f57d506 into shadowsocks:master Jun 13, 2022
@sorairolake sorairolake deleted the return-exit-code branch June 13, 2022 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants