]> git.proxmox.com Git - rustc.git/blame - src/libstd/sys/windows/ext/process.rs
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / libstd / sys / windows / ext / process.rs
CommitLineData
62682a34
SL
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
c1a9b12d 15use os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle};
62682a34
SL
16use process;
17use sys;
c1a9b12d 18use sys_common::{AsInner, FromInner, IntoInner};
62682a34
SL
19
20#[stable(feature = "process_extensions", since = "1.2.0")]
21impl 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")]
29impl AsRawHandle for process::Child {
30 fn as_raw_handle(&self) -> RawHandle {
31 self.as_inner().handle().raw() as *mut _
32 }
33}
34
92a42be0 35#[stable(feature = "process_extensions", since = "1.2.0")]
c1a9b12d
SL
36impl IntoRawHandle for process::Child {
37 fn into_raw_handle(self) -> RawHandle {
38 self.into_inner().into_handle().into_raw() as *mut _
39 }
40}
41
62682a34
SL
42#[stable(feature = "process_extensions", since = "1.2.0")]
43impl 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")]
50impl 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")]
57impl AsRawHandle for process::ChildStderr {
58 fn as_raw_handle(&self) -> RawHandle {
59 self.as_inner().handle().raw() as *mut _
60 }
61}
c1a9b12d 62
92a42be0 63#[stable(feature = "process_extensions", since = "1.2.0")]
c1a9b12d
SL
64impl IntoRawHandle for process::ChildStdin {
65 fn into_raw_handle(self) -> RawHandle {
66 self.into_inner().into_handle().into_raw() as *mut _
67 }
68}
69
92a42be0 70#[stable(feature = "process_extensions", since = "1.2.0")]
c1a9b12d
SL
71impl IntoRawHandle for process::ChildStdout {
72 fn into_raw_handle(self) -> RawHandle {
73 self.into_inner().into_handle().into_raw() as *mut _
74 }
75}
76
92a42be0 77#[stable(feature = "process_extensions", since = "1.2.0")]
c1a9b12d
SL
78impl IntoRawHandle for process::ChildStderr {
79 fn into_raw_handle(self) -> RawHandle {
80 self.into_inner().into_handle().into_raw() as *mut _
81 }
82}