Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
JRuby NoMethodError: undefined method `open?' for #<File:/dev/tty> #3340
irb(main):001:0> require "io/console" => false irb(main):002:0> IO.console => #<File:/dev/tty> irb(main):003:0> IO.console.winsize NoMethodError: undefined method `open?' for #<File:/dev/tty> from /usr/local/rbenv/versions/jruby-220.127.116.11/lib/ruby/stdlib/io/console.rb:159:in `console' from (irb):3:in `<eval>' from org/jruby/RubyKernel.java:979:in `eval' from org/jruby/RubyKernel.java:1292:in `loop' from org/jruby/RubyKernel.java:1099:in `catch' from org/jruby/RubyKernel.java:1099:in `catch' from /usr/local/rbenv/versions/jruby-18.104.22.168/bin/irb:13:in `<top>' irb(main):004:0>
referenced this issue
Sep 21, 2015
So I get the same behavior with my fix as MRI does but I had to make a guess. My guess was that since we are assuming that branch was dealing with an IO we should make sure it is in fact an IO before calling open?.
MRI implements all this in C and we implement ours in Ruby so a side-by-side comparison is difficult. I definitely made sure we will only safely call open? and the comment next to this like implies something about digging in internals of IO.
This is still a problem on JRuby 22.214.171.124: