[前][次][番号順一覧][スレッド一覧]

ruby-changes:55719

From: Nobuyoshi <ko1@a...>
Date: Tue, 14 May 2019 14:39:27 +0900 (JST)
Subject: [ruby-changes:55719] Nobuyoshi Nakada: c174670823 (trunk): io/console: fix up timeout on Windows

https://git.ruby-lang.org/ruby.git/commit/?id=c174670823

From c1746708233bf90270dca1f698ca3616cc16922c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 14 May 2019 14:39:08 +0900
Subject: io/console: fix up timeout on Windows


diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 2d63c1b..b8b3624 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) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L416
     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) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L429
 	    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 v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]