More robust plugins loading and error reporting

This prevents malformed scripts in plugins from breaking ntopng
This commit is contained in:
emanuele-f 2019-12-11 13:18:43 +01:00
parent 83f30ec0f3
commit e9a081903c
5 changed files with 213 additions and 65 deletions

View file

@ -630,7 +630,7 @@ function user_scripts.loadModule(ifid, script_type, subdir, mod_fname)
local full_path = os_utils.fixPath(checks_dir .. "/" .. mod_fname .. ".lua")
if ntop.exists(full_path) then
return(assert(loadfile(full_path))())
return(dofile(full_path))
end
end