Skip to content

Preserve Windows editor paths in gem open and bundle open#9694

Open
hsbt wants to merge 1 commit into
masterfrom
editor-command-windows-path
Open

Preserve Windows editor paths in gem open and bundle open#9694
hsbt wants to merge 1 commit into
masterfrom
editor-command-windows-path

Conversation

@hsbt

@hsbt hsbt commented Jul 15, 2026

Copy link
Copy Markdown
Member

gem open and bundle open cannot spawn an editor configured with a Windows native path. With EDITOR=C:\Program Files\Microsoft VS Code\Code.exe, gem open splits the value on whitespace and bundle open passes it through POSIX Shellwords, which additionally strips the backslashes, so both end up trying to execute C:Program and fail. The only working configuration is a bare executable name resolved through PATH.

Both commands now take an editor value that names an existing file as a single command word and fall back to Shellwords otherwise, so non-Windows platforms and editor commands with arguments are unaffected. This also switches gem open from naive whitespace splitting to Shellwords, matching bundle open, so a quoted editor path with arguments like "C:\Program Files\Microsoft VS Code\Code.exe" -w now works the same way in both commands.

Verified on x64-mswin64_140: gem open rake with GEM_EDITOR set to a full editor path containing spaces exited with status 1 before this change and opens the editor after it.

Copilot AI review requested due to automatic review settings July 15, 2026 07:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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
hsbt force-pushed the editor-command-windows-path branch from e5cbcdc to 5a5532a Compare July 15, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants