aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-05-10 01:29:26 +0200
committerKim Alvefur <zash@zash.se>2019-05-10 01:29:26 +0200
commita7e58a0c50dd7bf8d5321b50467707e93effc994 (patch)
treec9e13944e1a7fb90db78c72b9a565f0785980d15
parentf9f7ac859acc839ac4b7ff95de811717ab2afd7e (diff)
downloadprosody-a7e58a0c50dd7bf8d5321b50467707e93effc994.tar.gz
prosody-a7e58a0c50dd7bf8d5321b50467707e93effc994.zip
mod_admin_telnet: Move error handling to thread callback (fixes #1391)
Avoids yielding over pcall boundry, fixes xmpp:ping() command on Lua 5.1
-rw-r--r--plugins/mod_admin_telnet.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 50753f04..55ed89b8 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -62,6 +62,9 @@ end
function runner_callbacks:error(err)
module:log("error", "Traceback[telnet]: %s", err);
+
+ self.data.print("Fatal error while running command, it did not complete");
+ self.data.print("Error: "..tostring(err));
end
@@ -133,13 +136,7 @@ function console:process_line(session, line)
end
end
- local ranok, taskok, message = pcall(chunk);
-
- if not ranok then
- session.print("Fatal error while running command, it did not complete");
- session.print("Error: "..taskok);
- return;
- end
+ local taskok, message = chunk();
if not message then
session.print("Result: "..tostring(taskok));