bugfix: handle train errors in inspec execution

This commit is contained in:
Dominik Richter 2016-05-02 08:34:45 -04:00
parent 0fb88e2647
commit f30b6fb6f5
2 changed files with 3 additions and 3 deletions

View file

@ -140,8 +140,8 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
jres = res.respond_to?(:to_json) ? res.to_json : JSON.dump(res)
puts jres
end
rescue RuntimeError => e
puts e.message
rescue RuntimeError, Train::UserError => e
$stderr.puts e.message
end
desc 'version', 'prints the version of this tool'

View file

@ -68,7 +68,7 @@ module Inspec
runner = Inspec::Runner.new(o)
targets.each { |target| runner.add_target(target, opts) }
exit runner.run
rescue RuntimeError => e
rescue RuntimeError, Train::UserError => e
$stderr.puts e.message
exit 1
end