File tree Expand file tree Collapse file tree 2 files changed +14
-20
lines changed Expand file tree Collapse file tree 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::{
44} ;
55use crate :: pipe:: { PipeReader , PipeWriter } ;
66use crate :: process:: Stdio ;
7- use crate :: sys:: { handle:: Handle , pipe:: unnamed_anon_pipe} ;
7+ use crate :: sys:: c;
8+ use crate :: sys:: handle:: Handle ;
89use crate :: sys_common:: { FromInner , IntoInner } ;
910
11+ use core:: ptr;
12+
1013pub type AnonPipe = Handle ;
1114
12- #[ inline]
1315pub 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+ }
1526}
1627
1728#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
Original file line number Diff line number Diff line change @@ -39,23 +39,6 @@ pub struct Pipes {
3939 pub theirs : AnonPipe ,
4040}
4141
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-
5942/// Although this looks similar to `anon_pipe` in the Unix module it's actually
6043/// subtly different. Here we'll return two pipes in the `Pipes` return value,
6144/// 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