Change directory into the package dir when running hooks
This makes running external commands like `make` from hooks easier to do.
This commit is contained in:
parent
d67042b868
commit
0cd9fa1476
1 changed files with 6 additions and 0 deletions
|
|
@ -240,6 +240,11 @@ 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
|
||||
|
|
@ -248,6 +253,7 @@ local function run_hooks(package, type)
|
|||
end
|
||||
end
|
||||
|
||||
vim.fn.chdir(last_cwd)
|
||||
package.perf[type] = os.clock() - start
|
||||
|
||||
logger:log(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue