Sha256: 698ff1fd931051452d0efaf9cf7a252ff2ae0935b5e2bc0b33bbbde14dc6da4f

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

require "./lib/kommando"

calls_bytes = []
calls_icmp = []
calls_ttl_then_time = []

k = Kommando.new("ping -c 3 -i 0.2 127.0.0.1", {
  output: true
})

k.out.on("bytes") do
  calls_bytes << :only_bytes
end

k.out.once("icmp_seq") do
  calls_icmp << :first_icmp
end.once("icmp_seq") do
  calls_icmp << :second_icmp
end

k.out.once("ttl").once("time") do
  calls_ttl_then_time << :only_ttl_then_time
end

k.run

raise "err icmp" unless calls_icmp == [:first_icmp, :second_icmp]
raise "err bytes" unless calls_bytes == [:only_bytes]
raise "err ttl_then_time" unless calls_ttl_then_time == [:only_ttl_then_time]

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kommando-0.1.2 examples/out_once_chaining.rb
kommando-0.1.1 examples/out_once_chaining.rb
kommando-0.1.0 examples/out_once_chaining.rb