A
anon luker
Hi. I use Arton X's Activeruby package (ruby 1.8.0 (2003-08-04)
[i386-mswin32]), since it lets me do WSH stuff (ASP, COM, etc). I am
new to Ruby, and may have just made a luser error, but the following
does not work for me:
tt = Thread.new do
puts "listening..."
sleep 2
puts "listening..."
end
$stdin.each do |command|
break if command=~/quit/i or command=~/exit/i
tt.join if command=~/join/i
end
I expect it to print "listening..." twice, and it only prints it once.
If I type join, then I get the second message. The code works as
expected under Linux. I haven't tried other Windows builds, because
they don't include the WScript stuff.
Is this a common problem? Are there good workarounds? I thought Ruby
implemented the threads in some internal system independant way, so
this is confusing to me. Any help/info would be greatly appreciated.
thanks
[i386-mswin32]), since it lets me do WSH stuff (ASP, COM, etc). I am
new to Ruby, and may have just made a luser error, but the following
does not work for me:
tt = Thread.new do
puts "listening..."
sleep 2
puts "listening..."
end
$stdin.each do |command|
break if command=~/quit/i or command=~/exit/i
tt.join if command=~/join/i
end
I expect it to print "listening..." twice, and it only prints it once.
If I type join, then I get the second message. The code works as
expected under Linux. I haven't tried other Windows builds, because
they don't include the WScript stuff.
Is this a common problem? Are there good workarounds? I thought Ruby
implemented the threads in some internal system independant way, so
this is confusing to me. Any help/info would be greatly appreciated.
thanks