Quote executable name on Windows #1
Open
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.
On Windows, in the case where several arguments were given, the one
corresponding to the executable name was handled in a special way,
resolving and then converting it to its short version using
GetShortPathName.
Unfortunatelly, GetShortPathName is implemented at the file system
level and doesn't guarantee a file name that doesn't require quoting.
Specifically, when using VirtualBox shares, GetShortPathName can
return names with spaces inside.
In that case, the executable name with spaces was inserted unquoted
into the command line causing the invoked program to fail to parse its
arguments correctly.
For instance, running ["y:/foo bar/my.exe", "/d"] would result in the
invokation of "y:/foo bar/my.exe" with the command line "y:/foo
bar/my.exe /d" which would be break as ["y:/foo", "bar/my.exe", "/d"].
This patch, still resolves and normalizes the executable name before
passing it to Win32::Process::Create, but then when composing the
command line, it uses the former name as given by the user after
quoting it properly.