diff options
| author | bors <bors@rust-lang.org> | 2015-06-11 08:22:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-11 08:22:39 +0000 |
| commit | f6341a878e46084b3afca1f331ed470fb2bd092e (patch) | |
| tree | 2216d96dc5dae4058cee267f6c3d0a1e044b3d2b /src/libstd/sys/windows/ext | |
| parent | cf0edd0ad941a4a569e8afb17494cb1eb53373e9 (diff) | |
| parent | 56a5ff284a0a49558381230d5711cced9cba4605 (diff) | |
| download | rust-f6341a878e46084b3afca1f331ed470fb2bd092e.tar.gz rust-f6341a878e46084b3afca1f331ed470fb2bd092e.zip | |
Auto merge of #26159 - alexcrichton:tweak-process-lowering-raising, r=brson
* Slate these features to be stable in 1.2 instead of 1.1 (not being backported) * Have the `FromRawFd` implementations follow the contract of the `FromRawFd` trait by taking ownership of the primitive specified. * Refactor the implementations slightly to remove the `unreachable!` blocks as well as separating the stdio representation of `std::process` from `std::sys::process`. cc #25494
Diffstat (limited to 'src/libstd/sys/windows/ext')
| -rw-r--r-- | src/libstd/sys/windows/ext/process.rs | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index 0fd43a450f3..6f59be2687a 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -10,58 +10,43 @@ //! Extensions to `std::process` for Windows. -#![stable(feature = "from_raw_os", since = "1.1.0")] +#![stable(feature = "process_extensions", since = "1.2.0")] use os::windows::io::{FromRawHandle, RawHandle, AsRawHandle}; use process; use sys; use sys_common::{AsInner, FromInner}; -#[stable(feature = "from_raw_os", since = "1.1.0")] +#[stable(feature = "process_extensions", since = "1.2.0")] impl FromRawHandle for process::Stdio { - /// Creates a new instance of `Stdio` from the raw underlying handle. - /// - /// When this `Stdio` is used as an I/O handle for a child process the given - /// handle will be duplicated via `DuplicateHandle` to ensure that the - /// handle has the correct permissions to cross the process boundary. - /// - /// Note that this function **does not** take ownership of the handle - /// provided and it will **not** be closed when `Stdio` goes out of scope. - /// As a result this method is unsafe because due to the lack of knowledge - /// about the lifetime of the provided handle, this could cause another I/O - /// primitive's ownership property of its handle to be violated. - /// - /// Also note that this handle may be used multiple times to spawn - /// processes. For example the `Command::spawn` function could be called - /// more than once to spawn more than one process sharing this handle. unsafe fn from_raw_handle(handle: RawHandle) -> process::Stdio { - let handle = sys::handle::RawHandle::new(handle as *mut _); - process::Stdio::from_inner(sys::process::Stdio::Handle(handle)) + let handle = sys::handle::Handle::new(handle as *mut _); + process::Stdio::from_inner(handle) } } -#[stable(feature = "from_raw_os", since = "1.1.0")] +#[stable(feature = "process_extensions", since = "1.2.0")] impl AsRawHandle for process::Child { fn as_raw_handle(&self) -> RawHandle { self.as_inner().handle().raw() as *mut _ } } -#[stable(feature = "from_raw_os", since = "1.1.0")] +#[stable(feature = "process_extensions", since = "1.2.0")] impl AsRawHandle for process::ChildStdin { fn as_raw_handle(&self) -> RawHandle { self.as_inner().handle().raw() as *mut _ } } -#[stable(feature = "from_raw_os", since = "1.1.0")] +#[stable(feature = "process_extensions", since = "1.2.0")] impl AsRawHandle for process::ChildStdout { fn as_raw_handle(&self) -> RawHandle { self.as_inner().handle().raw() as *mut _ } } -#[stable(feature = "from_raw_os", since = "1.1.0")] +#[stable(feature = "process_extensions", since = "1.2.0")] impl AsRawHandle for process::ChildStderr { fn as_raw_handle(&self) -> RawHandle { self.as_inner().handle().raw() as *mut _ |
