fix(ui.open): use "start" instead of deprecated "rundll32" #36731

Problem:
The rundll32 utility is a leftover from Windows 95, and it has
been deprecated since at least Windows Vista.

Solution:
Use the start command through Command Prompt instead.
This commit is contained in:
ymich9963
2025-11-30 05:11:43 +00:00
committed by GitHub
parent 03d6cf7aae
commit c87d92c3b4

View File

@@ -169,11 +169,7 @@ function M.open(path, opt)
elseif vim.fn.has('mac') == 1 then
cmd = { 'open', path }
elseif vim.fn.has('win32') == 1 then
if vim.fn.executable('rundll32') == 1 then
cmd = { 'rundll32', 'url.dll,FileProtocolHandler', path }
else
return nil, 'vim.ui.open: rundll32 not found'
end
cmd = { 'cmd.exe', '/c', 'start', '', path }
elseif vim.fn.executable('xdg-open') == 1 then
cmd = { 'xdg-open', path }
job_opt.stdout = false