Skip to content

Commit 540cf43

Browse files
nobumatzbot
authored andcommitted
[ruby/io-console] Enable getpass methods always
ruby/io-console@57f9649df4
1 parent 1bbce42 commit 540cf43

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

ext/io/console/console.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ getattr(int fd, conmode *t)
7676
#endif
7777

7878
static ID id_getc, id_console, id_close;
79-
#if ENABLE_IO_GETPASS
8079
static ID id_gets, id_chomp_bang;
81-
#endif
8280

8381
#if defined HAVE_RUBY_FIBER_SCHEDULER_H
8482
# include "ruby/fiber/scheduler.h"
@@ -1534,7 +1532,6 @@ io_getch(int argc, VALUE *argv, VALUE io)
15341532
return rb_funcallv(io, id_getc, argc, argv);
15351533
}
15361534

1537-
#if ENABLE_IO_GETPASS
15381535
static VALUE
15391536
puts_call(VALUE io)
15401537
{
@@ -1615,7 +1612,6 @@ io_getpass(int argc, VALUE *argv, VALUE io)
16151612
puts_call(io);
16161613
return str;
16171614
}
1618-
#endif
16191615

16201616
/*
16211617
* IO console methods
@@ -1625,10 +1621,8 @@ Init_console(void)
16251621
{
16261622
#undef rb_intern
16271623
id_getc = rb_intern("getc");
1628-
#if ENABLE_IO_GETPASS
16291624
id_gets = rb_intern("gets");
16301625
id_chomp_bang = rb_intern("chomp!");
1631-
#endif
16321626
id_console = rb_intern("console");
16331627
id_close = rb_intern("close");
16341628
#define init_rawmode_opt_id(name) \
@@ -1676,16 +1670,12 @@ InitVM_console(void)
16761670
rb_define_method(rb_cIO, "clear_screen", console_clear_screen, 0);
16771671
rb_define_method(rb_cIO, "pressed?", console_key_pressed_p, 1);
16781672
rb_define_method(rb_cIO, "check_winsize_changed", console_check_winsize_changed, 0);
1679-
#if ENABLE_IO_GETPASS
16801673
rb_define_method(rb_cIO, "getpass", console_getpass, -1);
1681-
#endif
16821674
rb_define_singleton_method(rb_cIO, "console", console_dev, -1);
16831675
{
16841676
VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
16851677
rb_define_method(mReadable, "getch", io_getch, -1);
1686-
#if ENABLE_IO_GETPASS
16871678
rb_define_method(mReadable, "getpass", io_getpass, -1);
1688-
#endif
16891679
}
16901680
{
16911681
/* :stopdoc: */

ext/io/console/extconf.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
elsif have_func("rb_scheduler_timeout") # 3.0
3636
have_func("rb_io_wait")
3737
end
38-
$defs << "-D""ENABLE_IO_GETPASS=1"
3938
create_makefile("io/console") {|conf|
4039
conf << "\n""VK_HEADER = #{vk_header}\n"
4140
}

test/io/console/test_io_console.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ def test_setecho2
241241
end
242242

243243
def test_getpass
244-
omit unless IO.method_defined?("getpass")
245244
run_pty("p IO.console.getpass('> ')") do |r, w|
246245
assert_equal("> ", r.readpartial(10))
247246
sleep 0.1

0 commit comments

Comments
 (0)