Method: Inspec::UI#exit

Defined in:
lib/inspec/ui.rb

#exit(code_sym = :normal) ⇒ Object

#
Exit Codes
#


180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/inspec/ui.rb', line 180

def exit(code_sym = :normal)
  # If it's a number, give them a pass for now.
  if code_sym.is_a? Numeric
    code_int = code_sym
  else
    code_const = ("EXIT_" + code_sym.to_s.upcase).to_sym
    unless self.class.const_defined?(code_const)
      warning("Unrecognized exit constant #{code_const} - exit with code 1")
      exit(:usage_error)
    end
    code_int = self.class.const_get(code_const)
  end
  Kernel.exit(code_int)
end