Software /
code /
prosody
Changeset
12396:bdb9577a4830
util.prosodyctl.shell: Support for receiving partial lines (no automatic \n)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 17 Mar 2022 10:21:43 +0000 |
parents | 12395:1e34b910b73a |
children | 12397:ddf02f2a3354 |
files | util/prosodyctl/shell.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/prosodyctl/shell.lua Thu Mar 17 10:20:23 2022 +0000 +++ b/util/prosodyctl/shell.lua Thu Mar 17 10:21:43 2022 +0000 @@ -89,11 +89,15 @@ local errors = 0; -- TODO This is weird, but works for now. client.events.add_handler("received", function(stanza) if stanza.name == "repl-output" or stanza.name == "repl-result" then + local dest = io.stdout; if stanza.attr.type == "error" then errors = errors + 1; - io.stderr:write(stanza:get_text(), "\n"); + dest = io.stderr; + end + if stanza.attr.eol == "0" then + dest:write(stanza:get_text()); else - print(stanza:get_text()); + dest:write(stanza:get_text(), "\n"); end end if stanza.name == "repl-result" then