class Ring::SQA::MTR
Constants
- BIN
Public Class Methods
new(timeout=CFG.mtr.timeout)
click to toggle source
# File lib/ring/sqa/mtr.rb, line 24 def initialize timeout=CFG.mtr.timeout @timeout = timeout end
run(host)
click to toggle source
# File lib/ring/sqa/mtr.rb, line 9 def self.run host MTR.new.run host end
Public Instance Methods
run(host, args=nil)
click to toggle source
# File lib/ring/sqa/mtr.rb, line 13 def run host, args=nil Timeout::timeout(@timeout) do args ||= CFG.mtr.args.split(' ') mtr host, args end rescue Timeout::Error "MTR runtime exceeded #{@timeout}s" end
Private Instance Methods
mtr(host, *args)
click to toggle source
# File lib/ring/sqa/mtr.rb, line 28 def mtr host, *args out = '' args = [*args, host].flatten Open3.popen3(BIN, *args) do |stdin, stdout, stderr, wait_thr| out << stdout.read until stdout.eof? end 'mtr ' + args.join(' ') + "\n" + out.each_line.to_a[1..-1].join rescue '' end