Skip to content

Commit

Permalink
fix(cache): reload file if compiled code is incompatible. Fixes #225
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 29, 2022
1 parent 4e3a973 commit b8c5ab5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/lazy/core/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ function M.load(modkey, modpath)
entry.used = os.time()
if M.eq(entry.hash, hash) then
-- found in cache and up to date
return loadstring(entry.chunk --[[@as string]], "@" .. entry.modpath)
local chunk, err = loadstring(entry.chunk --[[@as string]], "@" .. entry.modpath)
if not (err and err:find("cannot load incompatible bytecode", 1, true)) then
return chunk, err
end
end
else
entry = { hash = hash, modpath = modpath, used = os.time() }
Expand Down

0 comments on commit b8c5ab5

Please sign in to comment.