pm2-githook icon indicating copy to clipboard operation
pm2-githook copied to clipboard

Current working directory is incorrect if targetApp.cwd is not specified.

Open Ishotihadus opened this issue 3 years ago • 0 comments

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.

Ishotihadus avatar Jun 02 '22 15:06 Ishotihadus