aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2025-03-13 11:37:11 +0000
committerMatthew Wild <mwild1@gmail.com>2025-03-13 11:37:11 +0000
commit57d168dd5e2684522df3c268be482430f3682e2b (patch)
treeb3b417ed12241fb7fe9e60b84f3f9c49ff322c99
parent384e3dbea2738e2c9b0c515fb865f1d07fda179e (diff)
downloadprosody-origin/13.0.tar.gz
prosody-origin/13.0.zip
prosodyctl shell: More reliable detection of REPL/interactive mode (fixes #1895)origin/13.013.0
-rw-r--r--plugins/mod_admin_shell.lua6
-rw-r--r--util/prosodyctl/shell.lua6
2 files changed, 5 insertions, 7 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 892844ff..28d758d0 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -342,6 +342,8 @@ local function handle_line(event)
local line = event.stanza:get_text();
local useglobalenv;
+ session.repl = event.stanza.attr.repl ~= "0";
+
local result = st.stanza("repl-result");
if line:match("^>") then
@@ -422,10 +424,6 @@ local function handle_line(event)
end
end
- if not source then
- session.repl = true;
- end
-
taskok, message = chunk(flags);
if promise.is_promise(taskok) then
diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua
index d72cf294..31936989 100644
--- a/util/prosodyctl/shell.lua
+++ b/util/prosodyctl/shell.lua
@@ -29,8 +29,8 @@ local function read_line(prompt_string)
end
end
-local function send_line(client, line)
- client.send(st.stanza("repl-input", { width = tostring(term_width()) }):text(line));
+local function send_line(client, line, interactive)
+ client.send(st.stanza("repl-input", { width = tostring(term_width()), repl = interactive == false and "0" or "1" }):text(line));
end
local function repl(client)
@@ -91,7 +91,7 @@ local function start(arg) --luacheck: ignore 212/arg
end
client.events.add_handler("connected", function()
- send_line(client, arg[1]);
+ send_line(client, arg[1], false);
return true;
end, 1);