diff options
-rw-r--r-- | win32/termios.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/termios.c b/win32/termios.c index 6d85ff98e..97d67eebb 100644 --- a/win32/termios.c +++ b/win32/termios.c | |||
@@ -10,7 +10,7 @@ int tcgetattr(int fd UNUSED_PARAM, struct termios *t UNUSED_PARAM) | |||
10 | return -1; | 10 | return -1; |
11 | } | 11 | } |
12 | 12 | ||
13 | int64_t FAST_FUNC read_key(int fd, char *buf, int timeout UNUSED_PARAM) | 13 | int64_t FAST_FUNC read_key(int fd, char *buf, int timeout) |
14 | { | 14 | { |
15 | static int initialized = 0; | 15 | static int initialized = 0; |
16 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); | 16 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); |
@@ -26,6 +26,10 @@ int64_t FAST_FUNC read_key(int fd, char *buf, int timeout UNUSED_PARAM) | |||
26 | initialized = 1; | 26 | initialized = 1; |
27 | } | 27 | } |
28 | 28 | ||
29 | if (timeout > 0) { | ||
30 | if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0) | ||
31 | goto done; | ||
32 | } | ||
29 | while (1) { | 33 | while (1) { |
30 | if (!ReadConsoleInput(cin, &record, 1, &nevent_out)) | 34 | if (!ReadConsoleInput(cin, &record, 1, &nevent_out)) |
31 | return -1; | 35 | return -1; |