On Windows it's possible to install the package using an admin console (since .git folders are read-only for normal users). Otherwise symlink creation will fail due to missing permissions (.cjs files -however- are created, so creating and removing symlinks seems to need more permissions, than file creation):\
Error: EPERM: operation not permitted, symlink './_do_hook.cjs' -> '[path\to\hooks]\applypatch-msg' (install.js:122:5)
Result in hooks with proper credentials (admin) will be e.g.:
btw. trying to include dynamic path separator into RegExp constructor string is a bit cumbersome due to a lack of proper build-in escaping for RegExp...\
new RegExp("."+needToRegExpEscape(path.sep)+"_do_hook(\\.cjs)?")
Would be nice to see a patch on this soon. And maybe you can mention this troubleshooting (admin console on Windows) in the README. Also, I had to guess where to put the config JSON, would be nice to mention the package.json in the README as well.
On Windows it's possible to install the package using an admin console (since
.git
folders are read-only for normal users). Otherwise symlink creation will fail due to missing permissions (.cjs files -however- are created, so creating and removing symlinks seems to need more permissions, than file creation):\Error: EPERM: operation not permitted, symlink './_do_hook.cjs' -> '[path\to\hooks]\applypatch-msg'
(install.js:122:5)Result in
hooks
with proper credentials (admin) will be e.g.:But uninstall is failing on removing symlinks due to different os path separator (baked into symlink string during creation).\ (codepointer)
fs.readlinkSync(hookPath)
gives'.\\_do_hook.cjs'
('.\\_do_hook'
before #7)Solution could be: adding different path sepatators as character class to RegExp literal
[\\/]
or (better readable): using os path separator from
path
module without RegExpbtw. trying to include dynamic path separator into RegExp constructor string is a bit cumbersome due to a lack of proper build-in escaping for RegExp...\
Would be nice to see a patch on this soon. And maybe you can mention this troubleshooting (admin console on Windows) in the README. Also, I had to guess where to put the config JSON, would be nice to mention the package.json in the README as well.
kind regards.