Class: PipelineToolkit::Cucumber::IOProcess

Inherits:
Object
  • Object
show all
Defined in:
lib/pipeline_toolkit/cucumber/io_process.rb

Overview

Provides an interface for running and interacting with a stdin/stdout process which talks messages.

Direct Known Subclasses

Machine

Instance Method Summary collapse

Instance Method Details

#get_output(number, timeout = 5) ⇒ Object

Gets the raw output of the process



31
32
33
34
35
36
37
# File 'lib/pipeline_toolkit/cucumber/io_process.rb', line 31

def get_output(number, timeout = 5)
  lines = []
  get_lines(@process.stdout, number, timeout) do |line|
    lines << line
  end
  lines
end

#killObject



17
18
19
20
# File 'lib/pipeline_toolkit/cucumber/io_process.rb', line 17

def kill
  @process.kill
  @process.wait
end

#pidObject



26
27
28
# File 'lib/pipeline_toolkit/cucumber/io_process.rb', line 26

def pid
  @process.pid
end

#run(command, path = "bin") ⇒ Object



10
11
12
13
14
15
# File 'lib/pipeline_toolkit/cucumber/io_process.rb', line 10

def run(command, path = "bin")
  @process = BackgroundProcess.run("ruby -rubygems #{path}/#{command}")
  # wait for process to start
  sleep(0.5)
  raise @process.stderr.gets unless @process.running?
end

#running?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pipeline_toolkit/cucumber/io_process.rb', line 22

def running?
  @process.running?
end