Sha256: 82036cd0460bb913560358cad35d9c560858fb9bafa07af5db659a48e16e7b33

Contents?: true

Size: 728 Bytes

Versions: 10

Compression:

Stored size: 728 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

path = './fixtures/timeout'
buffer = []
command = Shipit::Command.new({ path => { 'timeout' => 2 } }, env: {}, chdir: __dir__)
begin
  command.stream! do |chunk|
    buffer << chunk
  end
rescue Shipit::Command::TimedOut
  # expected
end

expected_output = [
  "Sleeping for 10 seconds\r\n",
  "\e[1;31mNo output received in the last 2 seconds.\e[0m\n",
  "\e[1;31mSending SIGINT to PID #{command.pid}\n\e[0m",
  "Recieved SIGINT, aborting.\r\n",
]

unless buffer.join == expected_output.join
  puts "Expected: -------"
  puts expected_output.map(&:inspect).join("\n")
  puts "Got: ------------"
  puts buffer.map(&:inspect).join("\n")
  puts "-----------------"
  exit(1)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 test/test_command_integration.rb
shipit-engine-0.38.0 test/test_command_integration.rb
shipit-engine-0.37.0 test/test_command_integration.rb
shipit-engine-0.36.1 test/test_command_integration.rb
shipit-engine-0.36.0 test/test_command_integration.rb
shipit-engine-0.35.1 test/test_command_integration.rb
shipit-engine-0.35.0 test/test_command_integration.rb
shipit-engine-0.34.0 test/test_command_integration.rb
shipit-engine-0.33.0 test/test_command_integration.rb
shipit-engine-0.32.0 test/test_command_integration.rb