-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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::exit does not document interpretation of the argument #35046
Comments
I don't know how to ask this more politely so I'll just go for it. Did you mean for your error code to spell out "boob" or is that a coincidence and the error code has some other semantic meaning to your program? |
I was meaning to spell out “Boo! Boo!”, because I remembered it accepting a i32 and had nothing better to do this evening. Alas. EDIT: I adjusted the report and inserted a |
It seems to me that Rust is already doing the correct thing:
Strace:
|
@tbu- unfortunately, somewhere along the way, it gets truncated down to a single byte. If you run that program and inspect the exit code, you should see 161. Looks like this is something that is platform-specific and we should just make a note of it in the docs. |
Just did a quick test to verify the behavior on other platforms. On Windows the exit code is definitely a 32bit integer and no truncation of its bits occurs. Whether it is signed or unsigned seems to vary. |
Finally, control is returned to the host environment. If the value of This is the C standard definition of |
We could do something like "if status is zero, then successful; if status is one, then unsuccessful; otherwise, implementation-defined" |
According to http://man7.org/linux/man-pages/man2/waitpid.2.html
|
from linux’s exit(3)
from OpenBSD exit(3)
from POSIX exit(3)
from OS X exit(3) Common topic here (as also pointed out by other people, already) is that its not the exit code that gets passed to IMO in this case both |
Opened a PR: #38397 If you have a moment, please give feedback! 😺 |
…exit, r=alexcrichton Document platform-specific differences for `std::process::exit`. Fixes rust-lang#35046.
…exit, r=alexcrichton Document platform-specific differences for `std::process::exit`. Fixes rust-lang#35046.
On systems where the glibc
exit
call is used, the exit code returned to the OS is actuallycode & 0xff
. This made my exit code of0xb00_b00
be a success.We should
either figure out how to makedocument this atrocity.glibc
pass through the exit code verbatim, orThe text was updated successfully, but these errors were encountered: