about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2016-12-19 16:59:36 +0900
committerGitHub <noreply@github.com>2016-12-19 16:59:36 +0900
commit0c4e1db935eb972c8e3afc7c15f48834dadaae3f (patch)
treef926906c5dc5e6db07f3517418f1ee991325aa78 /src/libstd
parent86cf9222e95ebfcfdfe1a1794c9295075dc16534 (diff)
parent4d392d355e49a9fd309765974d7a9d831e57172c (diff)
downloadrust-0c4e1db935eb972c8e3afc7c15f48834dadaae3f.tar.gz
rust-0c4e1db935eb972c8e3afc7c15f48834dadaae3f.zip
Rollup merge of #38397 - frewsxcv:platform-specific-process-exit, r=alexcrichton
Document platform-specific differences for `std::process::exit`.

Fixes https://github.com/rust-lang/rust/issues/35046.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/process.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 858537dd2de..2dcb8c2f152 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -828,6 +828,12 @@ 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
 ///
 /// ```
@@ -835,6 +841,17 @@ impl Child {
 ///
 /// 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();