Class: Termplot::Producers::CommandProducer

Inherits:
BaseProducer show all
Defined in:
lib/termplot/producers/command_producer.rb

Instance Method Summary collapse

Methods inherited from BaseProducer

#initialize, #on_message

Constructor Details

This class inherits a constructor from Termplot::Producers::BaseProducer

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/termplot/producers/command_producer.rb', line 7

def run
  temp_executable = make_executable(options.command)
  loop do
    n = `#{temp_executable.path}`.chomp
    # TODO: Error handling...

    produce(n)

    # Interval is in ms
    sleep(options.interval / 1000.0)
  end
ensure
  temp_executable.unlink
end