mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -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
|
return args
|
||||||
end # def run
|
end # def run
|
||||||
|
|
||||||
def self.valid_caller?
|
# @return true if this file is the main file being run and not via rspec
|
||||||
caller.none?{|entry| entry =~ /rspec/}
|
def self.autorun?
|
||||||
|
# caller is the current execution stack
|
||||||
|
$0 == __FILE__ && caller.none?{|entry| entry =~ /rspec/}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -244,6 +246,4 @@ class LogStash::Runner
|
||||||
end
|
end
|
||||||
end # class LogStash::Runner
|
end # class LogStash::Runner
|
||||||
|
|
||||||
if $0 == __FILE__ && LogStash::Runner.valid_caller?
|
LogStash::Runner.new.main(ARGV) if LogStash::Runner.autorun?
|
||||||
LogStash::Runner.new.main(ARGV)
|
|
||||||
end
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue