ruby-changes:63318
From: Nobuyoshi <ko1@a...>
Date: Sun, 11 Oct 2020 02:01:10 +0900 (JST)
Subject: [ruby-changes:63318] 37259e878f (master): [ruby/io-console] Relaxed min: option warning
https://git.ruby-lang.org/ruby.git/commit/?id=37259e878f From 37259e878f05db4106b67a9fc9cdc426d174282c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 10 Oct 2020 21:58:07 +0900 Subject: [ruby/io-console] Relaxed min: option warning When `min: 0` is given to `IO#getch` with `time:` option, it is expected to return nil if timed out, and needed for source code the compatibility with unixen platforms. https://github.com/ruby/io-console/commit/a2afbe72bd diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 11ce699..7d5181c 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -537,7 +537,13 @@ console_getch(int argc, VALUE *argv, VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L537 timeout = rb_scheduler_timeout(&tv); # endif } - if (optp->vmin != 1) { + switch (optp->vmin) { + case 1: /* default */ + break; + case 0: /* return nil when timed out */ + if (optp->vtime) break; + /* fallthru */ + default: rb_warning("min option ignored"); } if (optp->intr) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/