aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/async/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-11-07 00:25:16 +0100
committerWilliam Boman <william@redwill.se>2025-02-19 09:23:19 +0100
commit0329de4920a838e9196a5e2137e5d55f9ec7537c (patch)
tree1c68454cc36f2c5faa8498497a0f2bb47437516b /lua/mason-core/async/init.lua
parentrefactor: standardize constructors and improve inheritance construction (diff)
downloadmason-0329de4920a838e9196a5e2137e5d55f9ec7537c.tar
mason-0329de4920a838e9196a5e2137e5d55f9ec7537c.tar.gz
mason-0329de4920a838e9196a5e2137e5d55f9ec7537c.tar.bz2
mason-0329de4920a838e9196a5e2137e5d55f9ec7537c.tar.lz
mason-0329de4920a838e9196a5e2137e5d55f9ec7537c.tar.xz
mason-0329de4920a838e9196a5e2137e5d55f9ec7537c.tar.zst
mason-0329de4920a838e9196a5e2137e5d55f9ec7537c.zip
fix(async): also check async context termination immediately after suspending
Diffstat (limited to 'lua/mason-core/async/init.lua')
-rw-r--r--lua/mason-core/async/init.lua3
1 files changed, 3 insertions, 0 deletions
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