Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for std::process::ExitCode (feature process_exitcode_placeholder) #48711
Comments
frewsxcv
added
T-libs
C-tracking-issue
labels
Mar 4, 2018
scottmcm
referenced this issue
Mar 4, 2018
Merged
Better docs and associated SUCCESS/FAILURE for process::ExitCode #48618
This comment has been minimized.
This comment has been minimized.
|
From discussions we've had in the WG-CLI gitter, something that would be amazing to have would be a way to enumerate all possible exit codes for a program. We're currently looking into automatically creating man pages for CLIs, and being able to automatically document which exit codes are possible would let Rust do something that no other language does. I don't have any proposals on how to best approach this, but figured it would probably be worth bringing up. Thanks! edit: PS. I hope this is the right thread to mention this in! Apologies if I got it wrong! |
This comment has been minimized.
This comment has been minimized.
|
@yoshuawuyts Sounds like a cool feature! I don't know if this struct is exactly the thing you'd need, though, since it'll probably just remain a newtype. Maybe you could have a custom derive to generate |
This comment has been minimized.
This comment has been minimized.
raphaelcohn
commented
May 17, 2018
|
Would you consider also adding the definitions from For example:-
See https://github.com/bminor/musl/blob/master/include/sysexits.h for a full list. All part of any POSIX libc. In particular, it'd be nice if an uncaught panic resulted in an exit code of |
This comment has been minimized.
This comment has been minimized.
|
@raphaelcohn The design space here is still wide open, so it's certainly possible. There are some thoughts in the IRLO thread, but really it needs someone to dig in and make a proposal. As for uncaught panics, I believe they currently give a 101 exit code, not EXIT_FAILURE. |
scottmcm
referenced this issue
Feb 13, 2019
Open
Consider using `process::ExitCode`, and driving its design too #1
This comment has been minimized.
This comment has been minimized.
JoshMcguigan
commented
Feb 14, 2019
@yoshuawuyts Has any progress been made on this? I'm wondering if https://github.com/JoshMcguigan/exit could be expanded or somehow tied into some broader cli library to solve this problem? |
This comment has been minimized.
This comment has been minimized.
|
@JoshMcguigan hey, thanks for asking! I read your blog post, and I really like the work you've been doing! To answer your question: man now supports defining custom exit codes. However we haven't created any sort of bridge (e.g. the closest we've come is to create a bridge to clap). That said, I do have some thoughts on this. I was chatting with @davidbarsky last week about the It's worth mentioning that at the Rust all-hands there was talk about moving error chains ( I'm wondering if we could somehow merge all of these features into a single crate, and find a solution that works for most people. The features I'm currently thinking of are:
Haha, I hope all this makes sense. Sorry it's a lot of text; it's something I've been thinking about for a few months, but didn't quite get a chance to connect all pieces until now. I hope this is useful! |
scottmcm commentedMar 4, 2018
•
edited
https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html
Code added in #48497 (comment); changed to this issue in #48618
Creating this because
?-in-main(#43301) will probably stabilize firstThis is very minimal so far, and hasn't had an RFC. IRLO thread for what it should be.