diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-03-03 18:29:30 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-03-03 18:44:44 -0800 |
| commit | 74c5c6e6cb0425284f57fece6fbf248e827ea06d (patch) | |
| tree | d6c4863688aedf2527b3fa2dd806704b5ae0c33e /src/libstd/process.rs | |
| parent | 2ce2b40ee5f847f02d6da1b81f3303b8e8b23531 (diff) | |
| download | rust-74c5c6e6cb0425284f57fece6fbf248e827ea06d.tar.gz rust-74c5c6e6cb0425284f57fece6fbf248e827ea06d.zip | |
Move process::ExitCode internals to sys
Now begins the saga of fixing compilation errors on other platforms...
Diffstat (limited to 'src/libstd/process.rs')
| -rw-r--r-- | src/libstd/process.rs | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 5a06bf45aaa..d5ac2d19e83 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1098,38 +1098,26 @@ impl fmt::Display for ExitStatus { /// /// [RFC #1937]: https://github.com/rust-lang/rfcs/pull/1937 #[derive(Clone, Copy, Debug)] -#[unstable(feature = "process_exitcode_placeholder", issue = "43301")] -pub struct ExitCode(pub i32); +#[unstable(feature = "process_exitcode_placeholder", issue = "48711")] +pub struct ExitCode(imp::ExitCode); -#[cfg(target_arch = "wasm32")] -mod rawexit { - pub const SUCCESS: i32 = 0; - pub const FAILURE: i32 = 1; -} -#[cfg(not(target_arch = "wasm32"))] -mod rawexit { - use libc; - pub const SUCCESS: i32 = libc::EXIT_SUCCESS; - pub const FAILURE: i32 = libc::EXIT_FAILURE; -} - -#[unstable(feature = "process_exitcode_placeholder", issue = "43301")] +#[unstable(feature = "process_exitcode_placeholder", issue = "48711")] impl ExitCode { /// The canonical ExitCode for successful termination on this platform. /// /// Note that a `()`-returning `main` implicitly results in a successful /// termination, so there's no need to return this from `main` unless /// you're also returning other possible codes. - #[unstable(feature = "process_exitcode_placeholder", issue = "43301")] - pub const SUCCESS: ExitCode = ExitCode(rawexit::SUCCESS); + #[unstable(feature = "process_exitcode_placeholder", issue = "48711")] + pub const SUCCESS: ExitCode = ExitCode(imp::ExitCode::SUCCESS); /// The canonical ExitCode for unsuccessful termination on this platform. /// /// If you're only returning this and `SUCCESS` from `main`, consider /// instead returning `Err(_)` and `Ok(())` respectively, which will /// return the same codes (but will also `eprintln!` the error). - #[unstable(feature = "process_exitcode_placeholder", issue = "43301")] - pub const FAILURE: ExitCode = ExitCode(rawexit::FAILURE); + #[unstable(feature = "process_exitcode_placeholder", issue = "48711")] + pub const FAILURE: ExitCode = ExitCode(imp::ExitCode::FAILURE); } impl Child { @@ -1494,8 +1482,7 @@ impl<E: fmt::Debug> Termination for Result<!, E> { #[unstable(feature = "termination_trait_lib", issue = "43301")] impl Termination for ExitCode { fn report(self) -> i32 { - let ExitCode(code) = self; - code + self.0.as_i32() } } |
