diff options
| author | William Boman <william@redwill.se> | 2023-04-01 22:35:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-01 20:35:34 +0000 |
| commit | 1840ecc8442ac17527430a1941c82b9606341740 (patch) | |
| tree | 31534a4c6f8af0006884d0087c21c5a8162576c1 | |
| parent | feat(ui): display warning and error message if registry is not installed (#1164) (diff) | |
| download | mason-1840ecc8442ac17527430a1941c82b9606341740.tar mason-1840ecc8442ac17527430a1941c82b9606341740.tar.gz mason-1840ecc8442ac17527430a1941c82b9606341740.tar.bz2 mason-1840ecc8442ac17527430a1941c82b9606341740.tar.lz mason-1840ecc8442ac17527430a1941c82b9606341740.tar.xz mason-1840ecc8442ac17527430a1941c82b9606341740.tar.zst mason-1840ecc8442ac17527430a1941c82b9606341740.zip | |
fix(async): early return if no suspend functions (#1165)
| -rw-r--r-- | lua/mason-core/async/init.lua | 3 | ||||
| -rw-r--r-- | tests/mason-core/async/async_spec.lua | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lua/mason-core/async/init.lua b/lua/mason-core/async/init.lua index 0b327218..a6c7c8ef 100644 --- a/lua/mason-core/async/init.lua +++ b/lua/mason-core/async/init.lua @@ -188,6 +188,9 @@ end ---@param mode '"first"' | '"all"' local function wait(suspend_fns, mode) local channel = oneshot_channel() + if #suspend_fns == 0 then + return + end do local results = {} diff --git a/tests/mason-core/async/async_spec.lua b/tests/mason-core/async/async_spec.lua index 828a9409..fa111eed 100644 --- a/tests/mason-core/async/async_spec.lua +++ b/tests/mason-core/async/async_spec.lua @@ -195,4 +195,9 @@ describe("async", function() assert.equals("first", first) end) ) + + it("should yield back immediately when not providing any functions", function() + assert.is_nil(a.wait_first {}) + assert.is_nil(a.wait_all {}) + end) end) |
