diff options
author | Matthew Wild <mwild1@gmail.com> | 2022-03-17 10:21:43 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2022-03-17 10:21:43 +0000 |
commit | b617c24af4e1cc79fd27ed3dc852d6b9e53be543 (patch) | |
tree | 141d42dadd88bbf51403d48083cfff382dafbb91 /util/prosodyctl | |
parent | a946bdf4ae58e6aa2dea7915a5da67099a6e5c63 (diff) | |
download | prosody-b617c24af4e1cc79fd27ed3dc852d6b9e53be543.tar.gz prosody-b617c24af4e1cc79fd27ed3dc852d6b9e53be543.zip |
util.prosodyctl.shell: Support for receiving partial lines (no automatic \n)
Diffstat (limited to 'util/prosodyctl')
-rw-r--r-- | util/prosodyctl/shell.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index bce27b94..0b1dd3f9 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -89,11 +89,15 @@ local function start(arg) --luacheck: ignore 212/arg 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 |