Merge pull request #2 from phosphene47/hook-chdir
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user