mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
refactor valid_caller? into autorun?
This commit is contained in:
parent
323f42fdfd
commit
74d2fe2b04
1 changed files with 5 additions and 5 deletions
|
@ -233,8 +233,10 @@ class LogStash::Runner
|
|||
return args
|
||||
end # def run
|
||||
|
||||
def self.valid_caller?
|
||||
caller.none?{|entry| entry =~ /rspec/}
|
||||
# @return true if this file is the main file being run and not via rspec
|
||||
def self.autorun?
|
||||
# caller is the current execution stack
|
||||
$0 == __FILE__ && caller.none?{|entry| entry =~ /rspec/}
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -244,6 +246,4 @@ class LogStash::Runner
|
|||
end
|
||||
end # class LogStash::Runner
|
||||
|
||||
if $0 == __FILE__ && LogStash::Runner.valid_caller?
|
||||
LogStash::Runner.new.main(ARGV)
|
||||
end
|
||||
LogStash::Runner.new.main(ARGV) if LogStash::Runner.autorun?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue