mod_admin_shell: Wait for promises

I've typed `>require"util.async".wait_for(...)` for the last time!
This commit is contained in:
Kim Alvefur 2021-11-26 22:26:48 +01:00
parent b0ea55a155
commit aac203f0d9

View file

@ -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);