It's probably due to the fact that the Ruby interpreter
releases control to Windows when it waits for events. So you
have to have an event on a regular basis...I've had the same problem with a TCPServer and came up with the
following hack:# The hack...
def self.trap(signal)
Kernel::trap(signal){yield}
Thread.new{loop{sleep 1}} # Stupid Windows...
end
Who is the self in this case? TCPServer?
# Doesn't work with Kernel.trap .
# Try it!trap("INT"){puts "Terminating..." ; exit}
# Just a demo...
require "socket"
puts "Hit ^C..."
TCPServer.new("0.0.0.0", 1234).accept
I tried serveral permutations I could think of but nothing worked ![]()
Will continue Monday...