mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 12:49:11 +00:00
fix(system): use native path for Windows executables #40885
Problem: When 'shellslash' is set, exepath() returns forward-slashed paths. Passing that path to vim.system() can prevent cmd.exe from launching. Solution: Convert the resolved executable path to native separators before spawning. Add a Windows regression test for cmd.exe with 'shellslash' enabled.
This commit is contained in:
@@ -130,6 +130,17 @@ describe('vim.system', function()
|
||||
n.system_sync({ 'chmod', '+x', 'test.bat' })
|
||||
n.system_sync({ './test' })
|
||||
end)
|
||||
|
||||
it('launches cmd.exe when shellslash is set', function()
|
||||
n.command('set shellslash')
|
||||
local path = exec_lua([[return vim.fn.exepath('cmd.exe')]])
|
||||
t.neq(nil, path:find('/', 1, true))
|
||||
|
||||
local result = n.system_sync({ 'cmd.exe', '/c', 'echo OK' })
|
||||
eq(0, result.code)
|
||||
eq('OK\r\n', result.stdout)
|
||||
eq('', result.stderr)
|
||||
end)
|
||||
end
|
||||
|
||||
it('always captures all content of stdout/stderr #30846', function()
|
||||
|
||||
Reference in New Issue
Block a user