Sha256: 093802e5e1044614f4e2ed71ca878503eb1511797842bfabbc3978687b778aca

Contents?: true

Size: 622 Bytes

Versions: 8

Compression:

Stored size: 622 Bytes

Contents

# encoding: utf-8
require "childprocess"
module ClientProcessHelpers
  def start_client(timeout = 1)
    @client_out = Stud::Temporary.file
    @client_out.sync

    @process = ChildProcess.build(*cmd)
    @process.duplex = true
    @process.io.stdout = @process.io.stderr = @client_out
    ChildProcess.posix_spawn = true
    @process.start

    sleep(0.1)
    @client_out.rewind

    # can be used to helper debugging when a test fails
    @execution_output = @client_out.read
  end

  def stop_client
    begin
      @process.poll_for_exit(5)
    rescue ChildProcess::TimeoutError
      @process.stop
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
logstash-input-beats-3.0.4 spec/support/client_process_helpers.rb
logstash-input-beats-2.2.9 spec/support/client_process_helpers.rb
logstash-input-beats-3.0.3 spec/support/client_process_helpers.rb
logstash-input-beats-3.0.2 spec/support/client_process_helpers.rb
logstash-input-beats-3.0.1 spec/support/client_process_helpers.rb
logstash-input-beats-3.0.0 spec/support/client_process_helpers.rb
logstash-input-beats-2.2.8 spec/support/client_process_helpers.rb
logstash-input-beats-2.2.7 spec/support/client_process_helpers.rb