pm2-githook
pm2-githook copied to clipboard
Current working directory is incorrect if targetApp.cwd is not specified.
I think the code is intended to use pm_cwd as a current working directory if targetApp.cwd is not specified.
https://github.com/vmarchaud/pm2-githook/blob/9774c8b77a2b3d01d52c47b678429d6f33da9495/index.js#L129
But execOptions is not updated in this process, so an unintended directory is used as a current working directory on preHook and postHook.
I think the easiness solution is adding execOptions.cwd = targetApp.cwd; after updating targetApp.cwd.