# HG changeset patch # User Matthew Wild # Date 1741865831 0 # Node ID a28349b8a387a4ba6ab06e60d9328439f7267d65 # Parent 5cc4a3e0335c204d8ce5ad7eda526549ef7d7526 prosodyctl shell: More reliable detection of REPL/interactive mode (fixes #1895) diff -r 5cc4a3e0335c -r a28349b8a387 plugins/mod_admin_shell.lua --- 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 diff -r 5cc4a3e0335c -r a28349b8a387 util/prosodyctl/shell.lua --- 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);