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

Consider using process::ExitCode, and driving its design too #1

Open
scottmcm opened this issue Feb 13, 2019 · 2 comments
Open

Consider using process::ExitCode, and driving its design too #1

scottmcm opened this issue Feb 13, 2019 · 2 comments

Comments

@scottmcm
Copy link

There's the unstable std::process::ExitCode (tracking issue rust-lang/rust#48711) that also has a Termination impl: https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html#impl-Termination

It never had an RFC, so it needs someone to figure out what it should look like and how it should be used. Since you're looking at related things, maybe its worth experimenting with here?

It might be useful to have things define Into<ExitCode> instead of Into<i32>; I don't know.

@JoshMcguigan
Copy link
Owner

Hey, thanks for the comment. I was aware of std::process::ExitCode, but one of the goals of this crate is to allow a user to specify specific exit codes rather than simply generic success/failure. Unless I am missing something, requiring the user to impl Into<ExitCode> would restrict them to those two options.

Is there a way to extend ExitCode to this use case?

@scottmcm
Copy link
Author

scottmcm commented Feb 14, 2019

Thinks like "gee, this should have a way to do more than success/failure" are exactly the kind of design work that the type needs 🙂

For example, people have suggested providing constants for the BSD sysexits codes.

Certainly making them from integers is also logical. It's non-obvious if it should always support i32, or try to be u8 sometimes and DWORD on Windows, or what.

And who knows, maybe the Plan9 implementation should even make them from strings (http://man.cat-v.org/plan_9/2/exits).

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

No branches or pull requests

2 participants