Software /
code /
prosody
Diff
plugins/mod_admin_telnet.lua @ 10068:73a8192058f9
mod_admin_telnet: Move error handling to thread callback (fixes #1391)
Avoids yielding over pcall boundry, fixes xmpp:ping() command on Lua 5.1
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 May 2019 01:29:26 +0200 |
parent | 10067:598befab492e |
child | 10083:f30d505e755b |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Fri May 10 01:28:09 2019 +0200 +++ b/plugins/mod_admin_telnet.lua Fri May 10 01:29:26 2019 +0200 @@ -62,6 +62,9 @@ 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 @@ 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));