From 6620ae1c44dfa8623b22d0cbf873a9e8d073b849 Mon Sep 17 00:00:00 2001 From: Adrian Wang <86359799+0xDamn@users.noreply.github.com> Date: Mon, 23 Mar 2026 17:32:51 +0800 Subject: fix(install): use rename-before-unlink on all platforms Problem: On macOS Apple Silicon, a plain unlink can leave stale code signature metadata in the kernel cache, causing SIGKILL on next page fault after `TSUpdate`. Solution: Apply the rename-then-unlink strategy unconditionally instead of only on Windows. --- lua/nvim-treesitter/install.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 2c564b9ab..893f95361 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -322,13 +322,9 @@ end local function do_install(logger, compile_location, target_location) logger:info(string.format('Installing parser')) - if uv.os_uname().sysname == 'Windows_NT' then -- why can't you just be normal?! - local tempfile = target_location .. tostring(uv.hrtime()) - uv_rename(target_location, tempfile) -- parser may be in use: rename... - uv_unlink(tempfile) -- ...and mark for garbage collection - else - uv_unlink(target_location) -- don't disturb existing memory-mapped content - end + local tempfile = target_location .. tostring(uv.hrtime()) + uv_rename(target_location, tempfile) -- parser may be in use: rename... + uv_unlink(tempfile) -- ...and mark for garbage collection local err = uv_copyfile(compile_location, target_location) a.schedule() -- cgit v1.3