mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
aa17c063a4
commit
52c69c11d4
1 changed files with 5 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use std::{io, ops::{Deref, DerefMut}, time::Duration};
|
||||
use std::{ops::{Deref, DerefMut}, time::Duration};
|
||||
|
||||
pub struct AsyncStdin {
|
||||
inner: std::io::StdinLock<'static>,
|
||||
|
|
@ -43,7 +43,7 @@ impl AsyncStdin {
|
|||
};
|
||||
|
||||
match result {
|
||||
-1 => Err(io::Error::last_os_error()),
|
||||
-1 => Err(std::io::Error::last_os_error()),
|
||||
0 => Ok(false),
|
||||
_ => {
|
||||
self.reset();
|
||||
|
|
@ -69,9 +69,11 @@ impl AsyncStdin {
|
|||
pub fn poll(&mut self, timeout: Duration) -> std::io::Result<bool> {
|
||||
use std::os::windows::io::AsRawHandle;
|
||||
|
||||
use windows_sys::Win32::{Foundation::WAIT_TIMEOUT, System::Threading::WaitForSingleObject};
|
||||
|
||||
let handle = self.inner.as_raw_handle();
|
||||
let millis = timeout.as_millis();
|
||||
match unsafe { WaitForSingleObject(handle, millis) } {
|
||||
match unsafe { WaitForSingleObject(handle, millis as u32) } {
|
||||
WAIT_TIMEOUT => Ok(false),
|
||||
_ => Ok(true),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue