From c1746708233bf90270dca1f698ca3616cc16922c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 14 May 2019 14:39:08 +0900 Subject: io/console: fix up timeout on Windows --- ext/io/console/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/io/console') 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(); -- cgit v1.2.3