From cc0d2e5493f0f2b810ca243c650fa02d83084937 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 26 May 2019 19:01:03 -0700 Subject: [PATCH] termwiz: fixup key_tester example on macOS We need to set the terminal to blocking mode when we want poll_input to block forever, otherwise we immediately receive WouldBlock error response and quit the program. --- termwiz/src/terminal/unix.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/termwiz/src/terminal/unix.rs b/termwiz/src/terminal/unix.rs index 771962529..0af134eef 100644 --- a/termwiz/src/terminal/unix.rs +++ b/termwiz/src/terminal/unix.rs @@ -449,6 +449,12 @@ impl Terminal for UnixTerminal { }, ]; + self.read.set_blocking(if wait.is_none() { + Blocking::Wait + } else { + Blocking::DoNotWait + })?; + let poll_result = unsafe { poll( pfd.as_mut_ptr(),