aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlua/dep.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/lua/dep.lua b/lua/dep.lua
index ca179c5..2ae3105 100755
--- a/lua/dep.lua
+++ b/lua/dep.lua
@@ -240,14 +240,22 @@ local function run_hooks(package, type)
local start = os.clock()
+ -- chdir into the package directory to make running external commands
+ -- from hooks easier.
+ local last_cwd = vim.fn.getcwd()
+ vim.fn.chdir(package.dir)
+
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
end
+ vim.fn.chdir(last_cwd)
package.perf[type] = os.clock() - start
logger:log(