Hello, I know this topic has already been discussed here a while ago,
but I was wondering if anyone came up with a workaround or something.
I'm trying to write a script that checks email every - say - 10 minutes,
while still accepting user's input, so that one can stop it.
This code works perfectly under linux:
def Prova1
running = true
th = Thread.new do
while running
inp = gets.chomp
running = false if ["QUIT", "EXIT"].include?(inp.upcase)
puts "Ho ricevuto \"#{inp}\"..."
end
end
until th.join(0.5)
puts "Attesa..."
sleep 1
end
nil
end
but if run under Windows, the whole script stops as soon as "gets" is
reached, as if it was single-threaded.
···
--
Posted via http://www.ruby-forum.com/.