Ensure cwd is always restored to the original directory on hook failure

This commit is contained in:
phosphene47
2021-12-14 14:20:20 +11:00
parent 0cd9fa1476
commit b7ea828bdd

View File

@ -248,6 +248,8 @@ local function run_hooks(package, type)
for i = 1, #hooks do
local ok, err = pcall(hooks[i])
if not ok then
vim.fn.chdir(last_cwd)
package.error = true
return false, err
end