Sha256: e786de1f547b5224758c90c308fd7a77b0d1e9dd2e06b1f181366c5f5166800d

Contents?: true

Size: 377 Bytes

Versions: 3

Compression:

Stored size: 377 Bytes

Contents

require "./lib/kommando"

k = Kommando.new "sleep 2", {
  timeout: 0.1
}
k2 = Kommando.new "sleep 2", {
  timeout: 0.1
}

did_run_timeout_callback = false

k.when :timeout do
  did_run_timeout_callback = true
end

k.run
k2.run

if k.code == 1 && k2.code == 1
  puts "timed out"
else
  raise "code not 1"
end

raise "timeout callback not called" unless did_run_timeout_callback

Version data entries

3 entries across 3 versions & 1 rubygems

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