From 0329de4920a838e9196a5e2137e5d55f9ec7537c Mon Sep 17 00:00:00 2001 From: William Boman Date: Tue, 7 Nov 2023 00:25:16 +0100 Subject: fix(async): also check async context termination immediately after suspending --- lua/mason-core/async/init.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lua/mason-core/async/init.lua') diff --git a/lua/mason-core/async/init.lua b/lua/mason-core/async/init.lua index 56d86170..03963264 100644 --- a/lua/mason-core/async/init.lua +++ b/lua/mason-core/async/init.lua @@ -79,6 +79,9 @@ local function new_execution_context(suspend_fn, callback, ...) return end local ok, promise_or_result = co.resume(thread, ...) + if cancelled or not thread then + return + end if ok then if co.status(thread) == "suspended" then if getmetatable(promise_or_result) == Promise then -- cgit v1.2.3-70-g09d2