diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2022-04-04 05:59:51 +0100 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2022-04-04 05:59:51 +0100 |
| commit | 62f37da611deed29093e65c216bbb46ef9d5aef2 (patch) | |
| tree | 0ac1202c9189a693fa1a3fa7ecf1b25c3eea41d4 /library/std | |
| parent | 547504795ce95493bb2d55835e0f7567660a8b76 (diff) | |
| download | rust-62f37da611deed29093e65c216bbb46ef9d5aef2.tar.gz rust-62f37da611deed29093e65c216bbb46ef9d5aef2.zip | |
Update library/std/src/sys/windows/pipe.rs
Diffstat (limited to 'library/std')
| -rw-r--r-- | library/std/src/sys/windows/pipe.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/library/std/src/sys/windows/pipe.rs b/library/std/src/sys/windows/pipe.rs index 94a20514789..1723a331a32 100644 --- a/library/std/src/sys/windows/pipe.rs +++ b/library/std/src/sys/windows/pipe.rs @@ -308,14 +308,16 @@ impl AnonPipe { } // Wait indefinitely for the result. - while async_result.is_none() { + let result = loop { // STEP 2: Enter an alertable state. // The second parameter of `SleepEx` is used to make this sleep alertable. c::SleepEx(c::INFINITE, c::TRUE); - } + if let Some(result) = async_result { + break result; + } + }; // STEP 4: Return the result. - // `async_result` is always `Some` at this point. - let result = async_result.unwrap(); + // `async_result` is always `Some` at this point match result.error { c::ERROR_SUCCESS => Ok(result.transfered as usize), error => Err(io::Error::from_raw_os_error(error as _)), |
