about summary refs log tree commit diff
path: root/src/libstd/sys/unix/process/process_common.rs
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-09-24 21:34:44 -0700
committerTyler Mandry <tmandry@gmail.com>2019-09-25 15:26:42 -0700
commit80db06d6daa290fbc722fbae6dbfa0728ca259b5 (patch)
treebdc280e1a17f02b1d55a30cde069f77cad466202 /src/libstd/sys/unix/process/process_common.rs
parent6c2c29c43206d6e2f1091fa278d2792ea10e3659 (diff)
downloadrust-80db06d6daa290fbc722fbae6dbfa0728ca259b5.tar.gz
rust-80db06d6daa290fbc722fbae6dbfa0728ca259b5.zip
Fix ExitStatus on Fuchsia
Fuchsia exit codes don't follow the convention of libc::WEXITSTATUS et
al, and they are 64 bits instead of 32 bits. This gives Fuchsia its own
representation of ExitStatus.

Additionally, the zircon syscall structs were out of date, causing us to
see bogus return codes.
Diffstat (limited to 'src/libstd/sys/unix/process/process_common.rs')
-rw-r--r--src/libstd/sys/unix/process/process_common.rs51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs
index 713d3085559..4edd2ebf8c5 100644
--- a/src/libstd/sys/unix/process/process_common.rs
+++ b/src/libstd/sys/unix/process/process_common.rs
@@ -393,57 +393,6 @@ impl fmt::Debug for Command {
     }
 }
 
-/// Unix exit statuses
-#[derive(PartialEq, Eq, Clone, Copy, Debug)]
-pub struct ExitStatus(c_int);
-
-impl ExitStatus {
-    pub fn new(status: c_int) -> ExitStatus {
-        ExitStatus(status)
-    }
-
-    fn exited(&self) -> bool {
-        unsafe { libc::WIFEXITED(self.0) }
-    }
-
-    pub fn success(&self) -> bool {
-        self.code() == Some(0)
-    }
-
-    pub fn code(&self) -> Option<i32> {
-        if self.exited() {
-            Some(unsafe { libc::WEXITSTATUS(self.0) })
-        } else {
-            None
-        }
-    }
-
-    pub fn signal(&self) -> Option<i32> {
-        if !self.exited() {
-            Some(unsafe { libc::WTERMSIG(self.0) })
-        } else {
-            None
-        }
-    }
-}
-
-impl From<c_int> for ExitStatus {
-    fn from(a: c_int) -> ExitStatus {
-        ExitStatus(a)
-    }
-}
-
-impl fmt::Display for ExitStatus {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        if let Some(code) = self.code() {
-            write!(f, "exit code: {}", code)
-        } else {
-            let signal = self.signal().unwrap();
-            write!(f, "signal: {}", signal)
-        }
-    }
-}
-
 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
 pub struct ExitCode(u8);