Fix help being printed twice.

The bug was caused by 'agent.parse' failing with Clamp::HelpWanted and
then we would continue onward to try and actually run the agent.

Now we only run the agent if parsing args succeeds.

Fixes LOGSTASH-1952
This commit is contained in:
Jordan Sissel 2014-03-12 16:40:48 -07:00
parent 36148fae62
commit 75e6abd985

View file

@ -187,6 +187,7 @@ class LogStash::Runner
agent = LogStash::Agent.new($0) agent = LogStash::Agent.new($0)
begin begin
agent.parse(args) agent.parse(args)
@runners << Stud::Task.new { agent.execute }
rescue Clamp::HelpWanted => e rescue Clamp::HelpWanted => e
puts e.command.help puts e.command.help
rescue Clamp::UsageError => e rescue Clamp::UsageError => e
@ -196,9 +197,6 @@ class LogStash::Runner
remaining = agent.remaining_arguments remaining = agent.remaining_arguments
end end
#require "pry"
#binding.pry
@runners << Stud::Task.new { agent.execute }
return remaining return remaining
end end
} # commands } # commands