Class: Fauxpaas::PassthroughRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/fauxpaas/passthrough_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ PassthroughRunner

Returns a new instance of PassthroughRunner.



9
10
11
# File 'lib/fauxpaas/passthrough_runner.rb', line 9

def initialize(stream)
  @stream = stream
end

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



7
8
9
# File 'lib/fauxpaas/passthrough_runner.rb', line 7

def stream
  @stream
end

Instance Method Details

#run(command) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/fauxpaas/passthrough_runner.rb', line 13

def run(command)
  Open3.popen2e(command) do |_stdin, output, thread|
    while line = output.gets
      stream.puts line
    end
    exit_status = thread.value
  end
end