summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-18 10:33:25 +0900
committergit <svn-admin@ruby-lang.org>2023-08-18 03:55:02 +0000
commit540cf43205262d8208516d4046caabfdae62a45a (patch)
treec1471908c494f632c501016f37d94fa212762fe8
parent1bbce42964a29f86f28b51285bf976c4a28a1a9e (diff)
[ruby/io-console] Enable `getpass` methods always
https://github.com/ruby/io-console/commit/57f9649df4
-rw-r--r--ext/io/console/console.c10
-rw-r--r--ext/io/console/extconf.rb1
-rw-r--r--test/io/console/test_io_console.rb1
3 files changed, 0 insertions, 12 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 7f1872b3d8..5c31d990bc 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -76,9 +76,7 @@ getattr(int fd, conmode *t)
#endif
static ID id_getc, id_console, id_close;
-#if ENABLE_IO_GETPASS
static ID id_gets, id_chomp_bang;
-#endif
#if defined HAVE_RUBY_FIBER_SCHEDULER_H
# include "ruby/fiber/scheduler.h"
@@ -1534,7 +1532,6 @@ io_getch(int argc, VALUE *argv, VALUE io)
return rb_funcallv(io, id_getc, argc, argv);
}
-#if ENABLE_IO_GETPASS
static VALUE
puts_call(VALUE io)
{
@@ -1615,7 +1612,6 @@ io_getpass(int argc, VALUE *argv, VALUE io)
puts_call(io);
return str;
}
-#endif
/*
* IO console methods
@@ -1625,10 +1621,8 @@ Init_console(void)
{
#undef rb_intern
id_getc = rb_intern("getc");
-#if ENABLE_IO_GETPASS
id_gets = rb_intern("gets");
id_chomp_bang = rb_intern("chomp!");
-#endif
id_console = rb_intern("console");
id_close = rb_intern("close");
#define init_rawmode_opt_id(name) \
@@ -1676,16 +1670,12 @@ InitVM_console(void)
rb_define_method(rb_cIO, "clear_screen", console_clear_screen, 0);
rb_define_method(rb_cIO, "pressed?", console_key_pressed_p, 1);
rb_define_method(rb_cIO, "check_winsize_changed", console_check_winsize_changed, 0);
-#if ENABLE_IO_GETPASS
rb_define_method(rb_cIO, "getpass", console_getpass, -1);
-#endif
rb_define_singleton_method(rb_cIO, "console", console_dev, -1);
{
VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
rb_define_method(mReadable, "getch", io_getch, -1);
-#if ENABLE_IO_GETPASS
rb_define_method(mReadable, "getpass", io_getpass, -1);
-#endif
}
{
/* :stopdoc: */
diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb
index 3cbe8954d4..a72403c7f9 100644
--- a/ext/io/console/extconf.rb
+++ b/ext/io/console/extconf.rb
@@ -35,7 +35,6 @@ when true
elsif have_func("rb_scheduler_timeout") # 3.0
have_func("rb_io_wait")
end
- $defs << "-D""ENABLE_IO_GETPASS=1"
create_makefile("io/console") {|conf|
conf << "\n""VK_HEADER = #{vk_header}\n"
}
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 3f4b64bbcd..972b2e4cb4 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -241,7 +241,6 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
end
def test_getpass
- omit unless IO.method_defined?("getpass")
run_pty("p IO.console.getpass('> ')") do |r, w|
assert_equal("> ", r.readpartial(10))
sleep 0.1