Sha256: 24b79ffb75c70d65151d510afa3f81093da0f7c9a6d1df041113ce26b15904d7

Contents?: true

Size: 353 Bytes

Versions: 1

Compression:

Stored size: 353 Bytes

Contents

require "./lib/kommando"

k = Kommando.new "ping -i 0.2 127.0.0.1"

k.out.every /time=(\d+\.\d+)\s/ do |m|
  time = m[1].to_f
  print "#{time} ".ljust(6)
  puts "x" * (time*300.to_i)
end

k.out.once(/^PING.+\n$/).every(/^(.+)\r\n/) do |m|
  unless m[1].start_with? "64 bytes from"
    puts "ERR: unexpected reply: #{m[1]}"
    exit 1
  end
end


k.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kommando-0.1.0 demos/ping_monitor.rb