diff options
author | Patrick Walker <bpatrick.walker@gmail.com> | 2016-01-11 23:02:16 +0000 |
---|---|---|
committer | Patrick Walker <bpatrick.walker@gmail.com> | 2016-01-11 23:02:16 +0000 |
commit | 3719d656d5aae539c860f25d18368271724760b4 (patch) | |
tree | 27b6c879a23a76700d65e2cc12ddc77c34b687bc | |
parent | 136cf3be7fd7477309ce61fde052c02c446dc931 (diff) | |
download | chef-3719d656d5aae539c860f25d18368271724760b4.tar.gz |
Ensuring running Help returns an exit code of 0
-rw-r--r-- | lib/chef/application/knife.rb | 2 | ||||
-rw-r--r-- | spec/functional/knife/smoke_test.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb index d169a5dab5..11e3246cfb 100644 --- a/lib/chef/application/knife.rb +++ b/lib/chef/application/knife.rb @@ -162,7 +162,7 @@ class Chef::Application::Knife < Chef::Application print_help_and_exit(1, NO_COMMAND_GIVEN) elsif no_subcommand_given? if (want_help? || want_version?) - print_help_and_exit + print_help_and_exit(0) else print_help_and_exit(2, NO_COMMAND_GIVEN) end diff --git a/spec/functional/knife/smoke_test.rb b/spec/functional/knife/smoke_test.rb index 607e8065cf..b718bc50e0 100644 --- a/spec/functional/knife/smoke_test.rb +++ b/spec/functional/knife/smoke_test.rb @@ -31,4 +31,12 @@ describe "knife smoke tests" do knife_cmd.error! expect(knife_cmd.stdout).to include(Chef::VERSION) end + + it "can run and show help" do + knife_path = File.expand_path("../../bin/knife", CHEF_SPEC_DATA) + knife_cmd = Mixlib::ShellOut.new("#{knife_path} --help") + knife_cmd.run_command + knife_cmd.error! + expect(knife_cmd.stdout).to include("Usage") + end end |