Created
October 25, 2012 01:13
-
-
Save iconoclast/3949918 to your computer and use it in GitHub Desktop.
Test for IO.select bug as seen with jruby on aix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## simple test to check for broken IO.select behavior as seen with jruby on aix using java6 or java7 | |
## | |
require 'socket' | |
begin | |
port = ARGV.shift || '4321' | |
server = TCPServer.new('localhost', port) | |
client = TCPSocket.new('localhost', port) | |
sock = server.accept | |
readables, writeables, errors = IO.select([sock], [sock], [sock], 0) | |
# At this point there shouldn't be anything on the socket for us to read | |
fail 'IO.select seems to be broken for this system!' if (readables && readables.any?) | |
puts 'It appears that IO.select may be functioning correctly on this system' | |
ensure | |
server.close if server | |
client.close if client | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment