aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorphosphene47 <phosphene47@chiya.dev>2021-12-14 14:20:20 +1100
committerphosphene47 <phosphene47@chiya.dev>2021-12-14 14:20:20 +1100
commitb7ea828bdd98bca4eb188b2c5e5000a2dfccff05 (patch)
treef38e45c409832d4df5241e80caeb54936726cd9c /lua
parent0cd9fa1476c499946b636387676df3d0e2723a3c (diff)
downloaddep-b7ea828bdd98bca4eb188b2c5e5000a2dfccff05.tar.gz
dep-b7ea828bdd98bca4eb188b2c5e5000a2dfccff05.tar.bz2
dep-b7ea828bdd98bca4eb188b2c5e5000a2dfccff05.zip
Ensure cwd is always restored to the original directory on hook failure
Diffstat (limited to '')
-rwxr-xr-xlua/dep.lua2
1 files changed, 2 insertions, 0 deletions
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