Skip to content

Commit 62f37da

Browse files
committed
Update library/std/src/sys/windows/pipe.rs
1 parent 5475047 commit 62f37da

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/std/src/sys/windows/pipe.rs

+6-4
Original file line numberDiff line numberDiff 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 _)),

0 commit comments

Comments
 (0)