exit icon indicating copy to clipboard operation
exit copied to clipboard

Consider using `process::ExitCode`, and driving its design too

Open scottmcm opened this issue 6 years ago • 2 comments

There's the unstable std::process::ExitCode (tracking issue https://github.com/rust-lang/rust/issues/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.

scottmcm avatar Feb 13 '19 21:02 scottmcm

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?

JoshMcguigan avatar Feb 14 '19 00:02 JoshMcguigan

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).

scottmcm avatar Feb 14 '19 00:02 scottmcm