File tree 2 files changed +14
-20
lines changed
2 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,25 @@ use crate::os::windows::io::{
4
4
} ;
5
5
use crate :: pipe:: { PipeReader , PipeWriter } ;
6
6
use crate :: process:: Stdio ;
7
- use crate :: sys:: { handle:: Handle , pipe:: unnamed_anon_pipe} ;
7
+ use crate :: sys:: c;
8
+ use crate :: sys:: handle:: Handle ;
8
9
use crate :: sys_common:: { FromInner , IntoInner } ;
9
10
11
+ use core:: ptr;
12
+
10
13
pub type AnonPipe = Handle ;
11
14
12
- #[ inline]
13
15
pub fn pipe ( ) -> io:: Result < ( AnonPipe , AnonPipe ) > {
14
- unnamed_anon_pipe ( ) . map ( |( rx, wx) | ( rx. into_inner ( ) , wx. into_inner ( ) ) )
16
+ let mut read_pipe = c:: INVALID_HANDLE_VALUE ;
17
+ let mut write_pipe = c:: INVALID_HANDLE_VALUE ;
18
+
19
+ let ret = unsafe { c:: CreatePipe ( & mut read_pipe, & mut write_pipe, ptr:: null_mut ( ) , 0 ) } ;
20
+
21
+ if ret == 0 {
22
+ Err ( io:: Error :: last_os_error ( ) )
23
+ } else {
24
+ unsafe { Ok ( ( Handle :: from_raw_handle ( read_pipe) , Handle :: from_raw_handle ( write_pipe) ) ) }
25
+ }
15
26
}
16
27
17
28
#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
Original file line number Diff line number Diff line change @@ -39,23 +39,6 @@ pub struct Pipes {
39
39
pub theirs : AnonPipe ,
40
40
}
41
41
42
- /// Create true unnamed anonymous pipe.
43
- pub fn unnamed_anon_pipe ( ) -> io:: Result < ( AnonPipe , AnonPipe ) > {
44
- let mut read_pipe = c:: INVALID_HANDLE_VALUE ;
45
- let mut write_pipe = c:: INVALID_HANDLE_VALUE ;
46
-
47
- let ret = unsafe { c:: CreatePipe ( & mut read_pipe, & mut write_pipe, ptr:: null_mut ( ) , 0 ) } ;
48
-
49
- if ret == 0 {
50
- Err ( io:: Error :: last_os_error ( ) )
51
- } else {
52
- Ok ( (
53
- AnonPipe :: from_inner ( unsafe { Handle :: from_raw_handle ( read_pipe) } ) ,
54
- AnonPipe :: from_inner ( unsafe { Handle :: from_raw_handle ( write_pipe) } ) ,
55
- ) )
56
- }
57
- }
58
-
59
42
/// Although this looks similar to `anon_pipe` in the Unix module it's actually
60
43
/// subtly different. Here we'll return two pipes in the `Pipes` return value,
61
44
/// but one is intended for "us" where as the other is intended for "someone
You can’t perform that action at this time.
0 commit comments