Preserve Windows editor paths in gem open and bundle open#9694
Open
hsbt wants to merge 1 commit into
Open
Conversation
An editor configured with a Windows native path such as EDITOR=C:\Program Files\Microsoft VS Code\Code.exe was corrupted before being spawned: gem open split it on whitespace, and bundle open passed it through POSIX Shellwords which also consumes the backslashes. Take a value that names an existing file as a single word, and make gem open use Shellwords like bundle open so quoted editor commands work the same way in both.
hsbt
force-pushed
the
editor-command-windows-path
branch
from
July 15, 2026 08:34
e5cbcdc to
5a5532a
Compare
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.
gem openandbundle opencannot spawn an editor configured with a Windows native path. WithEDITOR=C:\Program Files\Microsoft VS Code\Code.exe,gem opensplits the value on whitespace andbundle openpasses it through POSIXShellwords, which additionally strips the backslashes, so both end up trying to executeC:Programand fail. The only working configuration is a bare executable name resolved throughPATH.Both commands now take an editor value that names an existing file as a single command word and fall back to
Shellwordsotherwise, so non-Windows platforms and editor commands with arguments are unaffected. This also switchesgem openfrom naive whitespace splitting toShellwords, matchingbundle open, so a quoted editor path with arguments like"C:\Program Files\Microsoft VS Code\Code.exe" -wnow works the same way in both commands.Verified on
x64-mswin64_140:gem open rakewithGEM_EDITORset to a full editor path containing spaces exited with status 1 before this change and opens the editor after it.