Mercurial > prosody-hg
comparison plugins/mod_admin_shell.lua @ 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 | 5cc4a3e0335c |
| children | c8e534b4f2e2 |
comparison
equal
deleted
inserted
replaced
| 13769:5cc4a3e0335c | 13770:a28349b8a387 |
|---|---|
| 340 session.width = (tonumber(event.stanza.attr.width) or default_width)-margin; | 340 session.width = (tonumber(event.stanza.attr.width) or default_width)-margin; |
| 341 | 341 |
| 342 local line = event.stanza:get_text(); | 342 local line = event.stanza:get_text(); |
| 343 local useglobalenv; | 343 local useglobalenv; |
| 344 | 344 |
| 345 session.repl = event.stanza.attr.repl ~= "0"; | |
| 346 | |
| 345 local result = st.stanza("repl-result"); | 347 local result = st.stanza("repl-result"); |
| 346 | 348 |
| 347 if line:match("^>") then | 349 if line:match("^>") then |
| 348 line = line:gsub("^>", ""); | 350 line = line:gsub("^>", ""); |
| 349 useglobalenv = true; | 351 useglobalenv = true; |
| 418 result.attr.type = "error"; | 420 result.attr.type = "error"; |
| 419 result:text("Sorry, I couldn't understand that... "..err); | 421 result:text("Sorry, I couldn't understand that... "..err); |
| 420 event.origin.send(result); | 422 event.origin.send(result); |
| 421 return; | 423 return; |
| 422 end | 424 end |
| 423 end | |
| 424 | |
| 425 if not source then | |
| 426 session.repl = true; | |
| 427 end | 425 end |
| 428 | 426 |
| 429 taskok, message = chunk(flags); | 427 taskok, message = chunk(flags); |
| 430 | 428 |
| 431 if promise.is_promise(taskok) then | 429 if promise.is_promise(taskok) then |
