fix(pack): use 'coxpcall.lua' on non-LuaJIT

Problem: `attempt to yield across metamethod/C-call boundary` error when
  trying to use `vim.pack.add()`.

Solution: use `pcall()` variant from 'coxpcall' on non-LuaJIT version of
  Lua.
This commit is contained in:
Evgeni Chasnovski
2025-07-29 16:00:03 +03:00
parent 1240d29f8f
commit 1ee18b4061
2 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
local M = {}
local max_timeout = 30000
local copcall = package.loaded.jit and pcall or require('coxpcall').pcall
--- @param thread thread
--- @param on_finish fun(err: string?, ...:any)
@@ -21,7 +22,7 @@ local function resume(thread, on_finish, ...)
--- @cast fn -string
--- @type boolean, string?
local ok, err = pcall(fn, function(...)
local ok, err = copcall(fn, function(...)
resume(thread, on_finish, ...)
end)