-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
std::process::ExitStatus Into Result, or .expect(), or something #73125
Comments
Add missing methods to unix ExitStatusExt These are the methods corresponding to the remaining exit status examination macros from `wait.h`. `WCOREDUMP` isn't in SuS but is it is very standard. I have not done portability testing to see if this builds everywhere, so I may need to Do Something if it doesn't. There is also a bugfix and doc improvement to `.signal()`, and an `.into_raw()` accessor. This would fix rust-lang#73128 and fix rust-lang#73129. Please let me know if you like this direction, and if so I will open the tracking issue and so on. If this MR goes well, I may tackle rust-lang#73125 next - I have an idea for how to do it.
Add missing methods to unix ExitStatusExt These are the methods corresponding to the remaining exit status examination macros from `wait.h`. `WCOREDUMP` isn't in SuS but is it is very standard. I have not done portability testing to see if this builds everywhere, so I may need to Do Something if it doesn't. There is also a bugfix and doc improvement to `.signal()`, and an `.into_raw()` accessor. This would fix rust-lang#73128 and fix rust-lang#73129. Please let me know if you like this direction, and if so I will open the tracking issue and so on. If this MR goes well, I may tackle rust-lang#73125 next - I have an idea for how to do it.
Add missing methods to unix ExitStatusExt These are the methods corresponding to the remaining exit status examination macros from `wait.h`. `WCOREDUMP` isn't in SuS but is it is very standard. I have not done portability testing to see if this builds everywhere, so I may need to Do Something if it doesn't. There is also a bugfix and doc improvement to `.signal()`, and an `.into_raw()` accessor. This would fix rust-lang#73128 and fix rust-lang#73129. Please let me know if you like this direction, and if so I will open the tracking issue and so on. If this MR goes well, I may tackle rust-lang#73125 next - I have an idea for how to do it.
@KodrAus apropos of recent discussion in #81452 and #73131: MotivationIt is far too easy to accidentally drop an Doing it right with the current API is highly un-ergonomic. We should be using Furthermore, there is no code in the Rust stdlib which will generate an appropriate message describing the fate of a subprocess. (I.e., generate a message comparable to that from the shell naming a fatal signal, or a message quoting the value passed to exit.) Proposal sketch
Improved ergonomicsThis allows the programmer to use Added functionalityThere is no new functionality here - only new more ergonomic types.
In fact I was confused and this behaviour is in the It would be nice to change the messages to something clearer, maybe:
but that is for the future. Example use
In a call site using
AlternativesDo nothingThis is unattractive because the existing API is cumbersome. Improving the ergnomics is necessary before making Return
|
I'm pretty sure I am going want this for rust-lang#73125 and it seems like an omission that would be in any case good to remedy. It's a shame we don't have competent token pasting and case mangling for use in macro_rules!. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Provide NonZero_c_* integers I'm pretty sure I am going want this for rust-lang#73125 and it seems like an omission that would be in any case good to remedy. <strike>Because the raw C types are in `std`, not `core`, to achieve this we must export the relevant macros from `core` so that `std` can use them. That's done with a new `num_internals` perma-unstable feature. The macros need to take more parameters for the module to get the types from and feature attributes to use. I have eyeballed the docs output for core, to check that my changes to these macros have made no difference to the core docs output.</strike>
Provide ExitStatusError Closes rust-lang#73125 In MR rust-lang#81452 "Add #[must_use] to [...] process::ExitStatus" we concluded that the existing arrangements in are too awkward so adding that `#[must_use]` is blocked on improving the ergonomics. I wrote a mini-RFC-style discusion of the approach in rust-lang#73125 (comment)
It is not particularly convenient to use the return value from
wait()
instd::process
. Perhaps it should be convertable to aResult
? Or gain its ownexpect
methods etc. ?The text was updated successfully, but these errors were encountered: