Class: Circus::ExternalUtil

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

Class Method Summary collapse

Class Method Details

.run_and_show_external(logger, desc, cmd) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/circus/external_util.rb', line 14

def self.run_and_show_external(logger, desc, cmd)
  IO.popen("#{cmd} 2>&1", 'r') do |pipe|
    while (line = pipe.gets)
      logger.info(line)
    end
  end
  
  true
end

.run_external(logger, desc, cmd) ⇒ Object



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

def self.run_external(logger, desc, cmd)
  res = `#{cmd} 2>&1`
  if $? != 0
    logger.error "#{desc} failed:"
    logger.error res
    false
  else
    true
  end
end