Software /
code /
prosody
Changeset
13770:a28349b8a387 13.0
prosodyctl shell: More reliable detection of REPL/interactive mode (fixes #1895)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 13 Mar 2025 11:37:11 +0000 |
parents | 13769:5cc4a3e0335c |
children | 13771:5f26164c738f 13772:df5d454859b3 |
files | plugins/mod_admin_shell.lua util/prosodyctl/shell.lua |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Thu Mar 13 11:35:39 2025 +0000 +++ b/plugins/mod_admin_shell.lua Thu Mar 13 11:37:11 2025 +0000 @@ -342,6 +342,8 @@ 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 @@ end end - if not source then - session.repl = true; - end - taskok, message = chunk(flags); if promise.is_promise(taskok) then
--- a/util/prosodyctl/shell.lua Thu Mar 13 11:35:39 2025 +0000 +++ b/util/prosodyctl/shell.lua Thu Mar 13 11:37:11 2025 +0000 @@ -29,8 +29,8 @@ 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 @@ end client.events.add_handler("connected", function() - send_line(client, arg[1]); + send_line(client, arg[1], false); return true; end, 1);