fix(install): preserve command return code on Windows

`:TSInstallSync` relies on the `:system()` command to set
`v:shell_error` when an error code is returned during installation. On
Windows, the error code was always overwritten by `popd`'s return code.
This commit is contained in:
Gabriel Holodak 2024-12-24 00:27:01 -05:00 committed by Christian Clason
parent 8acafab2bc
commit 82939d5941

View file

@ -353,9 +353,9 @@ end
function M.make_directory_change_for_command(dir, command)
if fn.has "win32" == 1 then
if string.find(vim.o.shell, "cmd") ~= nil then
return string.format("pushd %s & %s & popd", cmdpath(dir), command)
return string.format("pushd %s & %s", cmdpath(dir), command)
else
return string.format("pushd %s ; %s ; popd", cmdpath(dir), command)
return string.format("pushd %s ; %s", cmdpath(dir), command)
end
else
return string.format("cd %s;\n%s", dir, command)