Ensure cwd is always restored to the original directory on hook failure
This commit is contained in:
@ -248,6 +248,8 @@ local function run_hooks(package, type)
|
|||||||
for i = 1, #hooks do
|
for i = 1, #hooks do
|
||||||
local ok, err = pcall(hooks[i])
|
local ok, err = pcall(hooks[i])
|
||||||
if not ok then
|
if not ok then
|
||||||
|
vim.fn.chdir(last_cwd)
|
||||||
|
|
||||||
package.error = true
|
package.error = true
|
||||||
return false, err
|
return false, err
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user