mirror of
https://github.com/inspec/inspec
synced 2024-09-21 23:11:54 +00:00
bugfix: handle train errors in inspec execution
This commit is contained in:
parent
0fb88e2647
commit
f30b6fb6f5
2 changed files with 3 additions and 3 deletions
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue