class Ikaros::Command
Public Class Methods
new(command, options={})
click to toggle source
# File lib/ikaros/command.rb, line 5 def initialize(command, options={}) @command = command @options = options end
Public Instance Methods
run()
click to toggle source
# File lib/ikaros/command.rb, line 10 def run logger.debug @command result = '' Open3.popen3(@command) do |stdin, stdout, stderr, wait_thr| while line = stdout.gets result = "#{result}#{line}" logger.debug line logger.info line if output? end unless wait_thr.value.success? raise Error::CommandError.new stderr.gets(nil) end end result.chomp end
Private Instance Methods
logger()
click to toggle source
# File lib/ikaros/command.rb, line 31 def logger @logger ||= Ikaros.logger end
output?()
click to toggle source
# File lib/ikaros/command.rb, line 27 def output? @options[:output] end