diff --git a/src/tty/mod.rs b/src/tty/mod.rs index 37f80936e..491315482 100644 --- a/src/tty/mod.rs +++ b/src/tty/mod.rs @@ -19,7 +19,7 @@ pub trait RawMode: Sized { pub enum Event { KeyPress(KeyEvent), ExternalPrint(String), - #[cfg(unix)] + #[cfg(target_os = "macos")] Timeout(bool), } diff --git a/src/tty/unix.rs b/src/tty/unix.rs index c8b82ec9a..2f5a4d5c5 100644 --- a/src/tty/unix.rs +++ b/src/tty/unix.rs @@ -782,14 +782,17 @@ impl PosixRawReader { self.tty_in.get_ref().sigwinch()?; return Err(ReadlineError::WindowResized); } else if readfds.contains(tty_in) { + #[cfg(target_os = "macos")] if timeout.is_some() { return Ok(Event::Timeout(false)); - } else { - // prefer user input over external print - return self.next_key(single_esc_abort).map(Event::KeyPress); } + // prefer user input over external print + return self.next_key(single_esc_abort).map(Event::KeyPress); } else if timeout.is_some() { + #[cfg(target_os = "macos")] return Ok(Event::Timeout(true)); + #[cfg(not(target_os = "macos"))] + unreachable!() } else if let Some(ref pipe_reader) = self.pipe_reader { let mut guard = pipe_reader.lock().unwrap(); let mut buf = [0; 1];