Method: Inspec::RunnerRspec#exit_code

Defined in:
lib/inspec/runner_rspec.rb

#exit_codeint

Return a proper exit code to the runner

Returns:

  • (int)

    exit code



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/inspec/runner_rspec.rb', line 84

def exit_code
  return @rspec_exit_code if @formatter.results.empty?
  stats = @formatter.results[:statistics][:controls]
  if stats[:failed][:total] == 0 && stats[:skipped][:total] == 0
    0
  elsif stats[:failed][:total] > 0
    100
  elsif stats[:skipped][:total] > 0
    101
  else
    @rspec_exit_code
  end
end