Please review pull request #564: (#12981) Fix external subcommand exit status opened by (lotheac)
Description:
https://projects.puppetlabs.com/issues/12981
- Opened: Tue Mar 06 11:53:55 UTC 2012
- Based on: puppetlabs:master (b9ccf40c824f37f51b4c76fe85fe5bc8a479b498)
- Requested merge: lotheac:fix_subcommand_exit_status (6a312873eae3edd44ebec3c50f0cb9d55f053945)
Diff follows:
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index 244e2c2..409a08e 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -67,10 +67,7 @@ def execute
end
app.run
- elsif execute_external_subcommand then
- # Logically, we shouldn't get here, but we do, so whatever. We just
- # return to the caller. How strange we are. --daniel 2011-04-11
- else
+ elsif ! execute_external_subcommand then
unless subcommand_name.nil? then
puts "Error: Unknown Puppet subcommand '#{subcommand_name}'"
end
@@ -85,8 +82,7 @@ def execute_external_subcommand
path_to_subcommand = Puppet::Util.which(external_command)
return false unless path_to_subcommand
- system(path_to_subcommand, *args)
- true
+ exec(path_to_subcommand, *args)
end
def legacy_executable_name
diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb
index d60bbb1..d7bc7f8 100755
--- a/spec/unit/util/command_line_spec.rb
+++ b/spec/unit/util/command_line_spec.rb
@@ -87,7 +87,7 @@
it "should find and invoke an executable with a hyphenated name" do
commandline = Puppet::Util::CommandLine.new("puppet", ['whatever', 'argument'], @tty)
Puppet::Util.expects(:which).with('puppet-whatever').returns('/dev/null/puppet-whatever')
- commandline.expects(:system).with('/dev/null/puppet-whatever', 'argument')
+ commandline.expects(:exec).with('/dev/null/puppet-whatever', 'argument')
commandline.execute
end
@@ -96,7 +96,7 @@
it "should abort and show the usage message" do
commandline = Puppet::Util::CommandLine.new("puppet", ['whatever', 'argument'], @tty)
Puppet::Util.expects(:which).with('puppet-whatever').returns(nil)
- commandline.expects(:system).never
+ commandline.expects(:exec).never
expect {
commandline.execute
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
