File tree 1 file changed +11
-10
lines changed
library/std/src/sys/windows 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -521,17 +521,18 @@ fn program_exists(path: &Path) -> Option<Vec<u16>> {
521
521
522
522
impl Stdio {
523
523
fn to_handle ( & self , stdio_id : c:: DWORD , pipe : & mut Option < AnonPipe > ) -> io:: Result < Handle > {
524
- match * self {
525
- Stdio :: Inherit => match stdio:: get_handle ( stdio_id) {
526
- Ok ( io) => unsafe {
527
- let io = Handle :: from_raw_handle ( io) ;
528
- let ret = io. duplicate ( 0 , true , c:: DUPLICATE_SAME_ACCESS ) ;
529
- io. into_raw_handle ( ) ;
530
- ret
531
- } ,
532
- // If no stdio handle is available, then propagate the null value.
533
- Err ( ..) => unsafe { Ok ( Handle :: from_raw_handle ( ptr:: null_mut ( ) ) ) } ,
524
+ let use_stdio_id = |stdio_id| match stdio:: get_handle ( stdio_id) {
525
+ Ok ( io) => unsafe {
526
+ let io = Handle :: from_raw_handle ( io) ;
527
+ let ret = io. duplicate ( 0 , true , c:: DUPLICATE_SAME_ACCESS ) ;
528
+ io. into_raw_handle ( ) ;
529
+ ret
534
530
} ,
531
+ // If no stdio handle is available, then propagate the null value.
532
+ Err ( ..) => unsafe { Ok ( Handle :: from_raw_handle ( ptr:: null_mut ( ) ) ) } ,
533
+ } ;
534
+ match * self {
535
+ Stdio :: Inherit => use_stdio_id ( stdio_id) ,
535
536
536
537
Stdio :: MakePipe => {
537
538
let ours_readable = stdio_id != c:: STD_INPUT_HANDLE ;
You can’t perform that action at this time.
0 commit comments