aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_admin_shell.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 3b1ce277..bab5c4b2 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -135,8 +135,12 @@ local function handle_line(event)
return;
end
+ if useglobalenv and not session.globalenv then
+ session.globalenv = redirect_output(_G, session);
+ end
+
local chunkname = "=console";
- local env = (useglobalenv and redirect_output(_G, session)) or session.env or nil
+ local env = (useglobalenv and session.globalenv) or session.env or nil
-- luacheck: ignore 311/err
local chunk, err = envload("return "..line, chunkname, env);
if not chunk then