Method: Inspec::InspecCLI#exec

Defined in:
lib/inspec/cli.rb

#exec(*targets) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/inspec/cli.rb', line 176

def exec(*targets)
  o = opts(:exec).dup
  diagnose(o)
  configure_logger(o)

  runner = Inspec::Runner.new(o)
  targets.each { |target| runner.add_target(target) }

  exit runner.run
rescue ArgumentError, RuntimeError, Train::UserError => e
  $stderr.puts e.message
  exit 1
rescue StandardError => e
  pretty_handle_exception(e)
end