fix(launcher): escape parens in winget error echo (fixes 'is was unexpected at this time.')#26
Merged
Merged
Conversation
…e error Unescaped parentheses in '(App Installer)' inside the 'if errorlevel 1 (...)' block made cmd.exe misparse the block, failing with 'is was unexpected at this time.' on machines without Node.js (the only path that reaches this branch). Escaping the parens as ^( ^) fixes the parse while keeping the printed text identical.
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.
Problem
Launching
M2_LOG.cmd(orM2_LOG_Admin.cmd) on machines without Node.js failed with:Root cause
In the
:ensure_nodesubroutine, the error echo contained unescaped parentheses inside anif errorlevel 1 (...)block:cmd.exe structurally parses the whole
if (...)block before running it, treating(App Installer)as a nested group. The wordisright after the inner)then becomes an unexpected token, aborting the block.Why only "some" computers
Machines that already have Node.js hit the early
exit /b 0in:ensure_nodeand never reach this branch. Only machines missing Node.js fall through to the broken block, so the error appeared selectively.M2_LOG_Admin.cmdis affected too since itcallsM2_LOG.cmd.Fix
Escape the parentheses with
^:The block now parses correctly and the printed text is unchanged.
Verification
Reproduced the failure with a minimal repro (
is was unexpected at this time.) and confirmed the escaped version printswinget (App Installer) is not available...cleanly. Grepped both.cmdfiles; this was the onlyechowith unescaped parens.