class SystemCommand

class to call system command

Public Class Methods

exec_command(command) click to toggle source
# File lib/helper/system_command.rb, line 14
    def exec_command(command)
      output, error, status = Open3.capture3(command)

      raise <<-EOS.unindent unless status.exitstatus.zero?
        can not execute command: '#{command}'
        Output: #{output}
        Error: #{error}
      EOS
    end
exists?(command_name) click to toggle source
# File lib/helper/system_command.rb, line 7
def exists?(command_name)
  exec_command("which #{Shellwords.escape(command_name)}")
  true
rescue
  false
end