From 82939d5941cc939c0291699c1f7ee7046221aa17 Mon Sep 17 00:00:00 2001 From: Gabriel Holodak Date: Tue, 24 Dec 2024 00:27:01 -0500 Subject: [PATCH] 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. --- lua/nvim-treesitter/shell_command_selectors.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/shell_command_selectors.lua b/lua/nvim-treesitter/shell_command_selectors.lua index 48f610169..79bdb763f 100644 --- a/lua/nvim-treesitter/shell_command_selectors.lua +++ b/lua/nvim-treesitter/shell_command_selectors.lua @@ -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)