]> git.e2factory.org Git - e2factory.git/commitdiff
plugin: deinitialize plugins in reverse order
authorTobias Ulmer <tu@emlix.com>
Wed, 26 Jun 2019 15:50:14 +0000 (17:50 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 26 Jun 2019 15:51:08 +0000 (17:51 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/plugin.lua

index c895dd2721c6c5e10c780ee7ac3df968c714a001..65bc2f03c3c89ce606e9bd841871f5aad36c5a85 100644 (file)
@@ -241,13 +241,15 @@ end
 -- @return an error object on failure
 function plugin.exit_plugins()
     local e = err.new("deinitializing plugins failed")
-    for _, pd in ipairs(plugins) do
+    while #plugins > 0 do
+        local pd = table.remove(plugins) -- deinitialize in reverse order
+        e2lib.logf(4, "de-init plugin %s", pd.file)
         local rc, re = pd.exit(pd.ctx)
         if not rc then
             return false, e:cat(re)
         end
     end
-    return true, nil
+    return true
 end
 
 --- print a description for each plugin. This is for use with the --version