summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2022-02-01 21:56:08 +0900
committerNARUSE, Yui <naruse@airemix.jp>2022-02-01 21:56:08 +0900
commitcd4aae430da8303dac9f1be2d1e1b7ce1bc8a458 (patch)
treeb5e4c1705832f6390d8b974e6f864fdf882bbf96
parent8177e3b8d323c3e5d897a8c8239be5f1e9f8f11d (diff)
merge revision(s) f27eb8148f5a72bbacfebfecc7de9305471bb5c9,d75f7078c831d45ab5ba2fae4fbb308d01a21e46,d5836db1b398a7936b0461b3011db66f6cc8c490: [Backport #18443]
Sync io-console gem. --- ext/io/console/console.c | 8 ++++++-- test/io/console/test_io_console.rb | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) [ruby/io-console] bump up to 0.5.11 https://github.com/ruby/io-console/commit/ad3805200c --- ext/io/console/io-console.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Fix `Leaked file descriptor: TestIO_Console#test_console_kw` ``` Leaked file descriptor: TestIO_Console#test_console_kw: 10 : #<File:/dev/tty> ``` --- test/io/console/test_io_console.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
-rw-r--r--ext/io/console/console.c8
-rw-r--r--ext/io/console/io-console.gemspec2
-rw-r--r--test/io/console/test_io_console.rb10
-rw-r--r--version.h2
4 files changed, 18 insertions, 4 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 4c5f89f80d..4ec24178c4 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -90,6 +90,10 @@ extern VALUE rb_scheduler_timeout(struct timeval *timeout);
#define sys_fail_fptr(fptr) rb_sys_fail_str((fptr)->pathv)
#ifndef HAVE_RB_F_SEND
+#ifndef RB_PASS_CALLED_KEYWORDS
+# define rb_funcallv_kw(recv, mid, arg, argv, kw_splat) rb_funcallv(recv, mid, arg, argv)
+#endif
+
static ID id___send__;
static VALUE
@@ -104,7 +108,7 @@ rb_f_send(int argc, VALUE *argv, VALUE recv)
else {
vid = id___send__;
}
- return rb_funcallv(recv, vid, argc, argv);
+ return rb_funcallv_kw(recv, vid, argc, argv, RB_PASS_CALLED_KEYWORDS);
}
#endif
@@ -555,7 +559,7 @@ console_getch(int argc, VALUE *argv, VALUE io)
if (w < 0) rb_eof_error();
if (!(w & RB_WAITFD_IN)) return Qnil;
# else
- VALUE result = rb_io_wait(io, RUBY_IO_READABLE, timeout);
+ VALUE result = rb_io_wait(io, RB_INT2NUM(RUBY_IO_READABLE), timeout);
if (!RTEST(result)) return Qnil;
# endif
}
diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec
index 36beda7703..aa57f8ac52 100644
--- a/ext/io/console/io-console.gemspec
+++ b/ext/io/console/io-console.gemspec
@@ -1,5 +1,5 @@
# -*- ruby -*-
-_VERSION = "0.5.10"
+_VERSION = "0.5.11"
Gem::Specification.new do |s|
s.name = "io-console"
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 33b98990a1..3c29f9f2b3 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -407,6 +407,10 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
assert_equal(["true"], run_pty("IO.console(:close); p IO.console(:tty?)"))
end
+ def test_console_kw
+ assert_equal(["File"], run_pty("IO.console.close; p IO.console(:clone, freeze: true).class"))
+ end
+
def test_sync
assert_equal(["true"], run_pty("p IO.console.sync"))
end
@@ -483,6 +487,12 @@ defined?(IO.console) and TestIO_Console.class_eval do
IO.console(:close)
end
+ def test_console_kw
+ io = IO.console(:clone, freeze: true)
+ io.close
+ assert_kind_of(IO, io)
+ end
+
def test_sync
assert(IO.console.sync, "console should be unbuffered")
ensure
diff --git a/version.h b/version.h
index 0adb79b72f..d54c6d0f38 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 11
+#define RUBY_PATCHLEVEL 12
#define RUBY_RELEASE_YEAR 2022
#define RUBY_RELEASE_MONTH 2