Reopening a file descriptor on a socket doesn't work (gives "could not reopen: null (IOError)") -----------------------------------------------------------------------------------------------
Key: JRUBY-5222 URL: http://jira.codehaus.org/browse/JRUBY-5222 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.5.5, JRuby 1.1.6 Environment: Tested under Ubuntu 10.04, OpenJDK 1.6.0_18 Reporter: Matthew Bloch Priority: Minor STDIN.reopen doesn't work for me if I specify an open TCP socket, as it does in MRI. Here's a test: {code:title=reopen|borderStyle=solid} 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) {code} 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): {noformat} matt...@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) matt...@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) matt...@desk4:~$ ruby reopen "1.8.7" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" matt...@desk4:~$ {noformat} -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email