Class: OutputWatcher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ OutputWatcher

Returns a new instance of OutputWatcher.



4
5
6
7
8
9
10
11
12
# File 'lib/output_watcher.rb', line 4

def initialize(command)
  @stderr = ''
  @stdout = ''
  
  Open3.popen3(command) do |stdin, stdout, stderr|
    stderr.each_line { |line| @stderr << line }
    stdout.each_line { |line| @stdout << line }
  end
end

Instance Attribute Details

#stderrObject (readonly)

Returns the value of attribute stderr.



2
3
4
# File 'lib/output_watcher.rb', line 2

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



2
3
4
# File 'lib/output_watcher.rb', line 2

def stdout
  @stdout
end