From b7ea828bdd98bca4eb188b2c5e5000a2dfccff05 Mon Sep 17 00:00:00 2001 From: phosphene47 Date: Tue, 14 Dec 2021 14:20:20 +1100 Subject: Ensure cwd is always restored to the original directory on hook failure --- lua/dep.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/dep.lua b/lua/dep.lua index 93d665a..2ae3105 100755 --- a/lua/dep.lua +++ b/lua/dep.lua @@ -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 -- cgit v1.2.1