diff options
author | Kim Alvefur <zash@zash.se> | 2021-11-26 22:26:48 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-11-26 22:26:48 +0100 |
commit | aac203f0d96d2936719cde4ba0d79731a6f485e3 (patch) | |
tree | 55f3a2c0281b756e167e26efbca85bd4ea7a8a9a | |
parent | b0ea55a155dfe034f2d2117ed05e8c513676ea63 (diff) | |
download | prosody-aac203f0d96d2936719cde4ba0d79731a6f485e3.tar.gz prosody-aac203f0d96d2936719cde4ba0d79731a6f485e3.zip |
mod_admin_shell: Wait for promises
I've typed `>require"util.async".wait_for(...)` for the last time!
-rw-r--r-- | plugins/mod_admin_shell.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index 83891c04..123b5aa7 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -35,6 +35,7 @@ local async = require "util.async"; local serialization = require "util.serialization"; local serialize_config = serialization.new ({ fatal = false, unquoted = true}); local time = require "util.time"; +local promise = require "util.promise"; local t_insert = table.insert; local t_concat = table.concat; @@ -173,6 +174,10 @@ local function handle_line(event) local taskok, message = chunk(); + if promise.is_promise(taskok) then + taskok, message = async.wait_for(taskok); + end + if not message then if type(taskok) ~= "string" and useglobalenv then taskok = session.serialize(taskok); |