fix(windows): write node script to temp file instead of node -e#250
Open
scottconverse wants to merge 1 commit intoJuliusBrussee:mainfrom
Open
fix(windows): write node script to temp file instead of node -e#250scottconverse wants to merge 1 commit intoJuliusBrussee:mainfrom
scottconverse wants to merge 1 commit intoJuliusBrussee:mainfrom
Conversation
On Windows PowerShell 5.1, passing a multiline JS string via `node -e`
truncates the argument at the first double-quote character, causing a
SyntaxError mid-script. Fix: write the script to a temp file and run
`node tempfile.js`, cleaning up in a finally block.
Fixes install failing with:
[eval]:17
command: 'node '
SyntaxError: Unexpected end of input
JuliusBrussee
added a commit
that referenced
this pull request
Apr 30, 2026
PowerShell 5.1 mangles the multiline $nodeScript when passed to node -e — the embedded `"` after `node ` terminates the argument early, causing SyntaxError mid-install. Hook files copy but settings.json never updates, leaving caveman non-functional. Write the script to %TEMP%\caveman-install-<pid>.js, run it, clean up in a finally block. Verified clean install on Windows 11 / PowerShell 5.1 / Node 24. Closes #249. Co-Authored-By: Scott Converse <scottconverse@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #249
What broke
install.ps1failed on Windows PowerShell 5.1 with aSyntaxErrormid-script:Hook files were copied but
settings.jsonwas never updated, leaving caveman non-functional.Root cause
node -e $nodeScripton Windows passes the multiline string through the Windows command processor, which terminates the argument at the first"character. The JS string contains'node "' + hooksDir + ...— the"afternodeends the argument early.Fix
Write the script to a temp
.jsfile and runnode tempfile.js. Temp file is cleaned up in afinallyblock regardless of success or failure.Verified clean install output on Windows 11 / PowerShell 5.1 / Node v24.14.0.