aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/async/init.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/lua/mason-core/async/init.lua b/lua/mason-core/async/init.lua
index 50c84a71..63d4ec94 100644
--- a/lua/mason-core/async/init.lua
+++ b/lua/mason-core/async/init.lua
@@ -176,13 +176,14 @@ local function wait(suspend_fns, mode)
for i, suspend_fn in ipairs(suspend_fns) do
thread_cancellations[i] = exports.run(suspend_fn, function(success, result)
completed = completed + 1
+ if channel:is_closed() then
+ return
+ end
if not success then
- if not channel:is_closed() then
- cancel()
- channel:send(false, result)
- results = nil
- thread_cancellations = {}
- end
+ cancel()
+ channel:send(false, result)
+ results = nil
+ thread_cancellations = {}
else
results[i] = result
if mode == "first" or completed >= count then