summaryrefslogtreecommitdiff
path: root/ext/io
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-14 14:39:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-14 14:39:08 +0900
commitc1746708233bf90270dca1f698ca3616cc16922c (patch)
tree738122aafe17cd1193f4870122be7cf076e188a6 /ext/io
parent456586bb234915107da255d2944f620a7dd7048b (diff)
io/console: fix up timeout on Windows
Diffstat (limited to 'ext/io')
-rw-r--r--ext/io/console/console.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 2d63c1bfda..b8b36249b7 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -416,10 +416,10 @@ console_getch(int argc, VALUE *argv, VALUE io)
wint_t c;
int w, len;
char buf[8];
+ struct timeval *to = NULL, tv;
GetOpenFile(io, fptr);
if (optp) {
- struct timeval *to = NULL, tv;
if (optp->vtime) {
to = &tv;
tv.tv_sec = optp->vtime / 10;
@@ -429,7 +429,7 @@ console_getch(int argc, VALUE *argv, VALUE io)
rb_warning("min option ignored");
}
}
- w = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_IN, NULL);
+ w = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_IN, to);
if (w < 0) rb_eof_error();
if (!(w & RB_WAITFD_IN)) return Qnil;
c = _getwch();