ruby-changes:55718
From: Nobuyoshi <ko1@a...>
Date: Tue, 14 May 2019 14:22:05 +0900 (JST)
Subject: [ruby-changes:55718] Nobuyoshi Nakada: 456586bb23 (trunk): io/console: support getch timeout on Windows
https://git.ruby-lang.org/ruby.git/commit/?id=456586bb23 From 456586bb234915107da255d2944f620a7dd7048b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 14 May 2019 14:21:46 +0900 Subject: io/console: support getch timeout on Windows diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 0df6725..2d63c1b 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -419,7 +419,15 @@ console_getch(int argc, VALUE *argv, VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L419 GetOpenFile(io, fptr); if (optp) { - rb_warning("option ignored"); + struct timeval *to = NULL, tv; + if (optp->vtime) { + to = &tv; + tv.tv_sec = optp->vtime / 10; + tv.tv_usec = (optp->vtime % 10) * 100000; + } + if (optp->vmin) { + rb_warning("min option ignored"); + } } w = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_IN, NULL); if (w < 0) rb_eof_error(); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/