diff options
| author | Corey Farwell <coreyf@rwell.org> | 2016-12-15 16:07:37 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2016-12-18 09:47:22 -0800 |
| commit | 4d392d355e49a9fd309765974d7a9d831e57172c (patch) | |
| tree | 9c9adbc16379d2e7ae8b1b97b79bd126b43ad4d3 | |
| parent | d250169cb5a96481a3e7c8f9fe05de49f60e5ae5 (diff) | |
| download | rust-4d392d355e49a9fd309765974d7a9d831e57172c.tar.gz rust-4d392d355e49a9fd309765974d7a9d831e57172c.zip | |
Document platform-specific differences for `std::process::exit`.
Fixes https://github.com/rust-lang/rust/issues/35046.
| -rw-r--r-- | src/libstd/process.rs | 17 |
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(); |
