]> git.proxmox.com Git - rustc.git/blob - src/libstd/sys/windows/ext/process.rs
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / libstd / sys / windows / ext / process.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Extensions to `std::process` for Windows.
12
13 #![stable(feature = "process_extensions", since = "1.2.0")]
14
15 use os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle};
16 use process;
17 use sys;
18 use sys_common::{AsInner, FromInner, IntoInner};
19
20 #[stable(feature = "process_extensions", since = "1.2.0")]
21 impl FromRawHandle for process::Stdio {
22 unsafe fn from_raw_handle(handle: RawHandle) -> process::Stdio {
23 let handle = sys::handle::Handle::new(handle as *mut _);
24 process::Stdio::from_inner(handle)
25 }
26 }
27
28 #[stable(feature = "process_extensions", since = "1.2.0")]
29 impl AsRawHandle for process::Child {
30 fn as_raw_handle(&self) -> RawHandle {
31 self.as_inner().handle().raw() as *mut _
32 }
33 }
34
35 #[stable(feature = "process_extensions", since = "1.2.0")]
36 impl IntoRawHandle for process::Child {
37 fn into_raw_handle(self) -> RawHandle {
38 self.into_inner().into_handle().into_raw() as *mut _
39 }
40 }
41
42 #[stable(feature = "process_extensions", since = "1.2.0")]
43 impl AsRawHandle for process::ChildStdin {
44 fn as_raw_handle(&self) -> RawHandle {
45 self.as_inner().handle().raw() as *mut _
46 }
47 }
48
49 #[stable(feature = "process_extensions", since = "1.2.0")]
50 impl AsRawHandle for process::ChildStdout {
51 fn as_raw_handle(&self) -> RawHandle {
52 self.as_inner().handle().raw() as *mut _
53 }
54 }
55
56 #[stable(feature = "process_extensions", since = "1.2.0")]
57 impl AsRawHandle for process::ChildStderr {
58 fn as_raw_handle(&self) -> RawHandle {
59 self.as_inner().handle().raw() as *mut _
60 }
61 }
62
63 #[stable(feature = "process_extensions", since = "1.2.0")]
64 impl IntoRawHandle for process::ChildStdin {
65 fn into_raw_handle(self) -> RawHandle {
66 self.into_inner().into_handle().into_raw() as *mut _
67 }
68 }
69
70 #[stable(feature = "process_extensions", since = "1.2.0")]
71 impl IntoRawHandle for process::ChildStdout {
72 fn into_raw_handle(self) -> RawHandle {
73 self.into_inner().into_handle().into_raw() as *mut _
74 }
75 }
76
77 #[stable(feature = "process_extensions", since = "1.2.0")]
78 impl IntoRawHandle for process::ChildStderr {
79 fn into_raw_handle(self) -> RawHandle {
80 self.into_inner().into_handle().into_raw() as *mut _
81 }
82 }