File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -308,14 +308,16 @@ impl AnonPipe {
308308 }
309309
310310 // Wait indefinitely for the result.
311- while async_result . is_none ( ) {
311+ let result = loop {
312312 // STEP 2: Enter an alertable state.
313313 // The second parameter of `SleepEx` is used to make this sleep alertable.
314314 c:: SleepEx ( c:: INFINITE , c:: TRUE ) ;
315- }
315+ if let Some ( result) = async_result {
316+ break result;
317+ }
318+ } ;
316319 // STEP 4: Return the result.
317- // `async_result` is always `Some` at this point.
318- let result = async_result. unwrap ( ) ;
320+ // `async_result` is always `Some` at this point
319321 match result. error {
320322 c:: ERROR_SUCCESS => Ok ( result. transfered as usize ) ,
321323 error => Err ( io:: Error :: from_raw_os_error ( error as _ ) ) ,
You can’t perform that action at this time.
0 commit comments