Module: Bits::CommandProvider::ClassMethods

Defined in:
lib/bits/command_provider.rb

Instance Method Summary collapse

Instance Method Details

#check_command(command, name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bits/command_provider.rb', line 9

def check_command(command, name)
  begin
    exit_code = Bits.spawn command, :stdout => NULL
  rescue Errno::ENOENT
    log.debug "#{name} command not available"
    return false
  end

  if exit_code != 0 then
    log.debug "#{name} command could not be invoked"
    return false
  end

  log.debug "#{name} command available"
  true
end