Fail if init_module_paths called more than once
MSP-11672 Calling init_module_paths takes 6 seconds on my machine even when there are no files to that are changed just because it takes that long to walk the directories and gather the mtime for each file. Therefore, calling it more than once should be avoided. Also, there is no reason to call it twice as to add paths later, `modules.add_module_paths` should be used.bug/bundler_fix
parent
394d132d33
commit
653c71e029
|
@ -7,6 +7,9 @@ module Msf
|
||||||
#
|
#
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def init_module_paths(opts={})
|
def init_module_paths(opts={})
|
||||||
|
if @module_paths_inited
|
||||||
|
fail "Module paths already initialized. To add more module paths call `modules.add_module_path`"
|
||||||
|
else
|
||||||
# Ensure the module cache is accurate
|
# Ensure the module cache is accurate
|
||||||
self.modules.refresh_cache_from_database
|
self.modules.refresh_cache_from_database
|
||||||
|
|
||||||
|
@ -28,6 +31,9 @@ module Msf
|
||||||
self.modules.add_module_path(path, opts)
|
self.modules.add_module_path(path, opts)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@module_paths_inited = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue