Skip to content

Commit

Permalink
Rollup merge of rust-lang#38397 - frewsxcv:platform-specific-process-…
Browse files Browse the repository at this point in the history
…exit, r=alexcrichton

Document platform-specific differences for `std::process::exit`.

Fixes rust-lang#35046.
  • Loading branch information
sanxiyn authored Dec 19, 2016
2 parents 86cf922 + 4d392d3 commit 0c4e1db
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,13 +828,30 @@ impl Child {
/// this function at a known point where there are no more destructors left
/// to run.
///
/// ## Platform-specific behavior
///
/// **Unix**: On Unix-like platforms, it is unlikely that all 32 bits of `exit`
/// will be visible to a parent process inspecting the exit code. On most
/// Unix-like platforms, only the eight least-significant bits are considered.
///
/// # Examples
///
/// ```
/// use std::process;
///
/// process::exit(0);
/// ```
///
/// Due to [platform-specific behavior], the exit code for this example will be
/// `0` on Linux, but `256` on Windows:
///
/// ```no_run
/// use std::process;
///
/// process::exit(0x0f00);
/// ```
///
/// [platform-specific behavior]: #platform-specific-behavior
#[stable(feature = "rust1", since = "1.0.0")]
pub fn exit(code: i32) -> ! {
::sys_common::cleanup();
Expand Down

0 comments on commit 0c4e1db

Please sign in to comment.