Why is this running like it isn't threaded?
问题 I'm writing a script that will ping my ip range. Here's what I have so far: lines = `ipconfig`.split("\n") thr = [] ip_line = lines.detect { |l| l=~/Ip Address/i } matcher = /\d+\.\d+\.\d+\.\d+/.match(ip_line) if matcher.length > 0 address = matcher[0] address.sub!(/\.\d+$/,"") (1 .. 254).each do |i| xaddr = address + "." + i.to_s puts "pinging #{xaddr}" thr << Thread.new { `ping #{xaddr}` } end thr.each do |t| t.join output = t.value puts output end end The thing is, this executes extremely