fix: quote editor launch args on Windows to support paths with spaces#1805
fix: quote editor launch args on Windows to support paths with spaces#1805D3OXY wants to merge 1 commit intopingdotgg:mainfrom
Conversation
…aces On Windows, `launchDetached` uses `shell: true` so that editor commands are resolved via PATH. However, when the shell parses the concatenated command string, spaces in file paths are treated as argument separators. This causes "Open in Editor" to open one tab per word in the path instead of opening the project folder. Wrap each argument in double quotes on Windows before passing to `spawn()` so the shell keeps paths intact. Fixes pingdotgg#1804
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved This is a straightforward, self-contained bug fix that adds proper quoting for Windows paths with spaces when launching editors. The change is limited to a single spawn() call and follows a well-known pattern for Windows shell compatibility. You can customize Macroscope's approvability policy. Learn more. |
Summary
Fixes #1804
"Open in Editor" breaks on Windows when the project path contains spaces (e.g.
C:\bug showcase). The editor receives each space-separated word as a separate argument, opening multiple file tabs instead of the project folder.Root cause:
launchDetachedinapps/server/src/open.tsusesshell: trueon Windows so editor commands are resolved viaPATH. When Node'sspawnpasses args through the shell, unquoted spaces in paths are treated as argument separators.Fix: Wrap each argument in double quotes on Windows before passing to
spawn(), so the shell keeps paths with spaces intact. Non-Windows platforms are unchanged (they don't useshell: true).Test plan
C:\Users\test\My Projects\app)Note
Fix editor launch args quoting on Windows to support paths with spaces
In open.ts, each argument passed to the detached editor process is now wrapped in double quotes when running on Windows, fixing failures when paths contain spaces. Non-Windows behavior is unchanged.
Macroscope summarized 3f993c9.