2f66df0e10
`Shellwords.escape` escapes unquoted spaces with a backslash, but Windows does not treat backslash as an escape character. Escaping is also a problem when paths are expressed in shortened 8.3 format (e.g. `C:\Users\RubyOn~1\AppData\Local\Temp\...`) because a backslash will be erroneously added before the `~`. We can avoid the need to escape by using `system(command_name, *args)` instead of `system(command_line)`, but we must still support `ENV["EDITOR"]` values that embed command line arguments, such as `subl -w`. This commit changes to `system(command_name, *args)`, but uses `Shellwords.split` to extract any embedded arguments from `ENV["EDITOR"]`. This requires that Windows users put quotes around the entire path of their editor if it contains spaces, such as: ``` SET EDITOR="C:\Program Files\Microsoft VS Code\Code.exe" -w ``` In other words, the following are **not** supported on Windows: ``` SET "EDITOR=C:\Program Files\Microsoft VS Code\Code.exe" SET EDITOR=C:\Program Files\Microsoft VS Code\Code.exe SET EDITOR=C:\"Program Files"\"Microsoft VS Code"\Code.exe -w SET EDITOR=C:\Program^ Files\Microsoft^ VS^ Code\Code.exe -w SET EDITOR=C:\Program` Files\Microsoft` VS` Code\Code.exe -w ``` Fixes #41617 (again). Closes #44890. |
||
---|---|---|
.. | ||
minitest | ||
rails | ||
rails.rb |