mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Ensure that an empty invocation does not trigger the license check
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
e0fe3f1876
commit
f7c4f56670
2 changed files with 3 additions and 2 deletions
|
@ -390,7 +390,8 @@ commands_exempt_from_license_check = help_commands + version_commands
|
|||
#---------------------------------------------------------------------#
|
||||
require 'license_acceptance/acceptor'
|
||||
begin
|
||||
if (commands_exempt_from_license_check & ARGV.map(&:downcase)).empty?
|
||||
if (commands_exempt_from_license_check & ARGV.map(&:downcase)).empty? && # Did they use a non-exempt command?
|
||||
!ARGV.empty? # Did they supply at least one command?
|
||||
LicenseAcceptance::Acceptor.check_and_persist('inspec', Inspec::VERSION)
|
||||
end
|
||||
rescue LicenseAcceptance::LicenseNotAcceptedError
|
||||
|
|
|
@ -85,7 +85,7 @@ describe 'The license acceptance mechanism' do
|
|||
|
||||
describe 'when a command is used that should not be gated on licensure' do
|
||||
[
|
||||
'-h', '--help', 'help',
|
||||
'-h', '--help', 'help', '', # Empty invocation is treated as `inspec help`
|
||||
'-v', '--version', 'version',
|
||||
].each do |ungated_invocation|
|
||||
it "should not challenge for a license when running `inspec #{ungated_invocation}`" do
|
||||
|
|
Loading…
Reference in a new issue