mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 13:34:17 +02:00
[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.
a2afbe72bd
This commit is contained in:
parent
a79966743c
commit
37259e878f
1 changed files with 7 additions and 1 deletions
|
@ -537,7 +537,13 @@ console_getch(int argc, VALUE *argv, VALUE io)
|
||||||
timeout = rb_scheduler_timeout(&tv);
|
timeout = rb_scheduler_timeout(&tv);
|
||||||
# endif
|
# 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");
|
rb_warning("min option ignored");
|
||||||
}
|
}
|
||||||
if (optp->intr) {
|
if (optp->intr) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue