Software /
code /
prosody
Diff
util/prosodyctl/shell.lua @ 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 |
parent | 11902:98fd531594bd |
child | 12529:7dae6d29b71d |
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