[Bug: Windows] postinstall emits DEP0190 when launching Lefthook through shell:true #1734
DebtVC2022
started this conversation in
General
Replies: 1 comment
|
Independent confirmation of the root cause and your fix direction — we hit the exact same Two verified workarounds:
spawnSync('cmd.exe', ['/d', '/s', '/c', `${command} ${args.join(' ')}`], { windowsHide: true })That avoids the deprecated Your regression idea ( |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Environment
47f943859bef60e4160492346772ded9b24f765aReproduction
On an unmodified checkout at the commit above:
The normal
postinstallcompletes but printsDEP0190. The strict command exits with status 1.Actual behavior
On Windows,
runLefthook()launches thenode_modules/.bin/lefthook.cmdshim withspawnSync(..., { shell: true })while also passing['install', '--force']. Node.js 24 reports that combination asDEP0190; with--throw-deprecation, the installer terminates atscripts/install-lefthook.mjs:560before Lefthook runs.Expected behavior
The installer should run
lefthook install --forcewithout a command shell, emit noDEP0190warning, and preserve the existing worktree-local hook installation and rollback behavior.Root cause
The Windows-specific
.cmdlaunch requiresshell: true. Node then concatenates the separately supplied arguments into a shell command without escaping them, which is the deprecated and potentially unsafe pattern identified byDEP0190.The installed
lefthookpackage already declares a JavaScript bin entry (bin/index.js) that selects and launches its platform-native executable, so the package-manager shim is unnecessary here.Proposed patch
lefthookPackage.bin.lefthookundernode_modules/lefthook.process.execPathand the argumentsinstall --force.NODE_OPTIONS=--throw-deprecation.The local patch changes only:
scripts/install-lefthook.mjsscripts/install-lefthook.spec.tsVerification
The regression was first run against the unmodified launcher and failed with status 1 and
DEP0190at line 560. After the patch, these commands pass locally:The complete focused suite reports 33 passed and 6 skipped tests on Windows. The strict real-installer run exits 0, synchronizes the hooks, and emits no
DEP0190output.All reactions