Uh oh!
There was an error while loading. Please reload this page.
Expand documentation of process::exit and exec - #38518
Conversation
rust-highfive
commented
Dec 21, 2016
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
@bors: delegate=kmcallister r? @kmcallister |
bors
commented
Dec 21, 2016
✌️ @keeganmacallister can now approve this pull request |
bors
commented
Dec 21, 2016
✌️ @kmcallister can now approve this pull request |
There was a problem hiding this comment.
What do you think about this as an example:
use std::io::{self,Write};use std::process;fnrun_app() -> Result<(),()>{// Your application logic hereOk(())}fnmain(){
process::exit(matchrun_app(){Ok(_) => 0,Err(_) => 1,});}There was a problem hiding this comment.
I personally prefer to not include an import for only one use of a function. I incorporated some of the other changes.
There was a problem hiding this comment.
Why are you printing the error if the error type is ()?
There was a problem hiding this comment.
I suppose I can see why, but it does seem unrelated to the point of this example. Not a big deal.
There was a problem hiding this comment.
Would it be more accurate to replace "any other thread's" with "child thread's"?
There was a problem hiding this comment.
No. “Child thread” makes sense in relation to “main thread”, but you can call process::exit on any thread you want.
There was a problem hiding this comment.
Is this platform specific behavior? I'm not familiar with how all the platforms handle execvp
There was a problem hiding this comment.
It is not. We always try our best to set CLOEXEC on all filedescriptors in the standard library and the behaviour of execvp wrt CLOEXEC fds is documented in posix: http://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html
nagisa
commented
Jan 7, 2017
Ping? |
There was a problem hiding this comment.
I think the documentation uses American English, so this should be "behavior"
Show a conventional way to use process::exit when destructors are considered important and also mention that the same caveats wrt destructors apply to exec as well.
alexcrichton
commented
Feb 4, 2017
@bors: r+ |
bors
commented
Feb 4, 2017
📌 Commit c2eab73 has been approved by |
frewsxcv
commented
Feb 4, 2017
@bors rollup |
Expand documentation of process::exit and exec Show a conventional way to use process::exit when destructors are considered important and also mention that the same caveats wrt destructors apply to exec as well.
Expand documentation of process::exit and exec Show a conventional way to use process::exit when destructors are considered important and also mention that the same caveats wrt destructors apply to exec as well.
Show a conventional way to use process::exit when destructors are considered important and also
mention that the same caveats wrt destructors apply to exec as well.