diff options
Diffstat (limited to 'win32/termios.c')
-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 34a17bbfd..390b90382 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 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); | 15 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); |
16 | INPUT_RECORD record; | 16 | INPUT_RECORD record; |
@@ -24,6 +24,10 @@ int64_t FAST_FUNC read_key(int fd, char *buf, int timeout UNUSED_PARAM) | |||
24 | GetConsoleMode(cin, &mode); | 24 | GetConsoleMode(cin, &mode); |
25 | SetConsoleMode(cin, 0); | 25 | SetConsoleMode(cin, 0); |
26 | 26 | ||
27 | if (timeout > 0) { | ||
28 | if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0) | ||
29 | goto done; | ||
30 | } | ||
27 | while (1) { | 31 | while (1) { |
28 | if (!ReadConsoleInput(cin, &record, 1, &nevent_out)) | 32 | if (!ReadConsoleInput(cin, &record, 1, &nevent_out)) |
29 | goto done; | 33 | goto done; |