Ensure cwd is always restored to the original directory on hook failure
This commit is contained in:
parent
0cd9fa1476
commit
b7ea828bdd
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue