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 {
308
308
}
309
309
310
310
// Wait indefinitely for the result.
311
- while async_result . is_none ( ) {
311
+ let result = loop {
312
312
// STEP 2: Enter an alertable state.
313
313
// The second parameter of `SleepEx` is used to make this sleep alertable.
314
314
c:: SleepEx ( c:: INFINITE , c:: TRUE ) ;
315
- }
315
+ if let Some ( result) = async_result {
316
+ break result;
317
+ }
318
+ } ;
316
319
// 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
319
321
match result. error {
320
322
c:: ERROR_SUCCESS => Ok ( result. transfered as usize ) ,
321
323
error => Err ( io:: Error :: from_raw_os_error ( error as _ ) ) ,
You can’t perform that action at this time.
0 commit comments