diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-09 12:50:20 -0700 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-09 14:59:20 -0700 |
| commit | d394aa064e54943fcf3e1c73007e4b17a13328ca (patch) | |
| tree | 3692b59628ee281458df6b44b6cb661ca8c51f61 /src/libstd/sys/windows/ext | |
| parent | faca79fc332f62b339aee5bd994b00e52d9ac051 (diff) | |
| parent | 7f09b1f6a64339370440025d50d0ad4a7f239734 (diff) | |
| download | rust-d394aa064e54943fcf3e1c73007e4b17a13328ca.tar.gz rust-d394aa064e54943fcf3e1c73007e4b17a13328ca.zip | |
Rollup merge of #33224 - alexcrichton:create-exit-status, r=aturon
std: Allow creating ExitStatus from raw values Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
Diffstat (limited to 'src/libstd/sys/windows/ext')
| -rw-r--r-- | src/libstd/sys/windows/ext/process.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index f6ee59eec32..56c6a73d4f8 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -81,3 +81,18 @@ impl IntoRawHandle for process::ChildStderr { self.into_inner().into_handle().into_raw() as *mut _ } } + +/// Windows-specific extensions to `std::process::ExitStatus` +#[unstable(feature = "exit_status_from", issue = "32713")] +pub trait ExitStatusExt { + /// Creates a new `ExitStatus` from the raw underlying `u32` return value of + /// a process. + fn from_raw(raw: u32) -> Self; +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExitStatusExt for process::ExitStatus { + fn from_raw(raw: u32) -> Self { + process::ExitStatus::from_inner(From::from(raw)) + } +} |
