fix(windows): quote command-line tokens, drop duplicated argv[0] - #22
Open
LarryHsiao wants to merge 1 commit into
Open
fix(windows): quote command-line tokens, drop duplicated argv[0]#22LarryHsiao wants to merge 1 commit into
LarryHsiao wants to merge 1 commit into
Conversation
build_command() concatenated executable + arguments into one Win32 command line with no quoting, so any executable under a space-containing path (e.g. the default Git-for-Windows install location, 'C:\Program Files\Git\bin\bash.exe') broke: CreateProcessW/the child's own argv-recovery misparsed the space as a token boundary. It also wrote the executable twice: options->arguments[0] already duplicates it (the Dart side prepends it so Unix's execvp() gets a conventional argv[0]), but build_command() also unconditionally wrote its own executable parameter first, then all of arguments including that duplicate. Fixes both: quote each token that contains a space or tab (Windows filenames cannot contain a double quote, so no escaping of embedded quotes is needed), and skip arguments[0] since it is not a real argument.
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.
build_command()(Windows backend,flutter_pty_win.c) joinsexecutableandargumentsinto one Win32 command-line string with no quoting, so any executable under a space-containing path — e.g. Git for Windows' default install location,C:\Program Files\Git\bin\bash.exe— breaks:CreateProcessW/the child's own argv-recovery misparses the space as a token boundary.options->arguments[0]already duplicates it (the Dart side prepends it so Unix'sexecvp()gets a conventional argv[0] — correct there), butbuild_command()unconditionally writes its ownexecutableparameter first and iterates all ofarguments, including that duplicate.", so no escaping of embedded quotes is needed), and skipsarguments[0]on the Windows side since it isn't a real argument there.🤖 Generated with Claude Code