mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
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:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user