require 'win32ole'
wsh = WIN32OLE.new("Wscript.Shell")

wsh_exec = wsh.Exec('gem.bat list -r')
t1 = Thread.new do
	loop do
		puts :t1_run
		line = wsh_exec.StdOut.ReadLine
		#puts line
		sleep(0.05)
	end
end

t2 = Thread.new do
	while wsh_exec.Status == 0 do
		sleep(0.05)
		puts :t2_run
	end
end

while t2.alive? do
	sleep(0.05)
end