about summary refs log tree commit diff
path: root/src/libstd/sys/redox
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-03-06 20:01:07 -0600
committerAlex Crichton <alex@alexcrichton.com>2018-03-06 23:38:06 -0800
commitde3a63d663b5ba262c05a1147488614e054209a4 (patch)
tree8774da3bced0d037dc6c423a290a9d8038dd7a77 /src/libstd/sys/redox
parenta06aed1df7f0bf6a2083d6b0434428ef2242cff9 (diff)
parent74c5c6e6cb0425284f57fece6fbf248e827ea06d (diff)
downloadrust-de3a63d663b5ba262c05a1147488614e054209a4.tar.gz
rust-de3a63d663b5ba262c05a1147488614e054209a4.zip
Rollup merge of #48618 - scottmcm:elaborate-exitcode, r=alexcrichton
Better docs and associated SUCCESS/FAILURE for process::ExitCode

Follow-up to https://github.com/rust-lang/rust/pull/48497#discussion_r170676525, since that PR was the minimal thing to unblock https://github.com/rust-lang/rust/issues/48453#issuecomment-368155082.

r? @nikomatsakis
Diffstat (limited to 'src/libstd/sys/redox')
-rw-r--r--src/libstd/sys/redox/process.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs
index 3fd54973896..d0b94e14f54 100644
--- a/src/libstd/sys/redox/process.rs
+++ b/src/libstd/sys/redox/process.rs
@@ -13,6 +13,7 @@ use ffi::OsStr;
 use os::unix::ffi::OsStrExt;
 use fmt;
 use io::{self, Error, ErrorKind};
+use libc::{EXIT_SUCCESS, EXIT_FAILURE};
 use path::{Path, PathBuf};
 use sys::fd::FileDesc;
 use sys::fs::{File, OpenOptions};
@@ -480,6 +481,18 @@ impl fmt::Display for ExitStatus {
     }
 }
 
+#[derive(PartialEq, Eq, Clone, Copy, Debug)]
+pub struct ExitCode(u8);
+
+impl ExitCode {
+    pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
+    pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
+
+    pub fn as_i32(&self) -> i32 {
+        self.0 as i32
+    }
+}
+
 /// The unique id of the process (this should never be negative).
 pub struct Process {
     pid: usize,