Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.6, JRuby 1.5.5
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Tested under Ubuntu 10.04, OpenJDK 1.6.0_18
-
Number of attachments :
Description
STDIN.reopen doesn't work for me if I specify an open TCP socket, as it does in MRI. Here's a test:
reopen
p RUBY_VERSION begin p JRUBY_VERSION p Java::java::lang::System.getProperty("java.vendor") p Java::java::lang::System.getProperty("java.version") rescue NameError => name end require 'socket' server = TCPServer.new("127.0.0.1",11112) another_thread = Thread.new { TCPSocket.new("127.0.0.1",11112).write("x"*99) } client = server.accept STDIN.reopen(client) p STDIN.read(99)
And here's me running it under a couple of different Javas, and JRuby 1.5.5. The same thing happened under the ancient system JRuby (1.1.6):
mattbee@desk4:~$ JAVA_HOME=/usr/lib/jvm/java-6-sun /usr/local/jruby-1.5.5/bin/jruby reopen "1.8.7" "1.5.5" "Sun Microsystems Inc." "1.6.0_22" reopen:14: could not reopen: null (IOError) mattbee@desk4:~$ JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk /usr/local/jruby-1.5.5/bin/jruby reopen "1.8.7" "1.5.5" "Sun Microsystems Inc." "1.6.0_18" reopen:14: could not reopen: null (IOError) mattbee@desk4:~$ ruby reopen "1.8.7" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" mattbee@desk4:~$
I just double-checked the behaviour on a bleeding-edge git build, and it does the same thing.