]> git.proxmox.com Git - rustc.git/blame - src/libstd/sys/windows/ext/process.rs
Imported Upstream version 1.3.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
c1a9b12d
SL
35impl IntoRawHandle for process::Child {
36 fn into_raw_handle(self) -> RawHandle {
37 self.into_inner().into_handle().into_raw() as *mut _
38 }
39}
40
62682a34
SL
41#[stable(feature = "process_extensions", since = "1.2.0")]
42impl AsRawHandle for process::ChildStdin {
43 fn as_raw_handle(&self) -> RawHandle {
44 self.as_inner().handle().raw() as *mut _
45 }
46}
47
48#[stable(feature = "process_extensions", since = "1.2.0")]
49impl AsRawHandle for process::ChildStdout {
50 fn as_raw_handle(&self) -> RawHandle {
51 self.as_inner().handle().raw() as *mut _
52 }
53}
54
55#[stable(feature = "process_extensions", since = "1.2.0")]
56impl AsRawHandle for process::ChildStderr {
57 fn as_raw_handle(&self) -> RawHandle {
58 self.as_inner().handle().raw() as *mut _
59 }
60}
c1a9b12d
SL
61
62impl IntoRawHandle for process::ChildStdin {
63 fn into_raw_handle(self) -> RawHandle {
64 self.into_inner().into_handle().into_raw() as *mut _
65 }
66}
67
68impl IntoRawHandle for process::ChildStdout {
69 fn into_raw_handle(self) -> RawHandle {
70 self.into_inner().into_handle().into_raw() as *mut _
71 }
72}
73
74impl IntoRawHandle for process::ChildStderr {
75 fn into_raw_handle(self) -> RawHandle {
76 self.into_inner().into_handle().into_raw() as *mut _
77 }
78}