diff options
| author | Robert Muir <rmuir@apache.org> | 2026-02-19 09:39:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-19 15:39:22 +0100 |
| commit | 3edb01f912867603c2aef9079f208f0244c0885b (patch) | |
| tree | 8620f4687fcc37d52595c6e1d9bcbcadd92d36d7 /lua | |
| parent | feat(kotlin)!: update parser and queries (diff) | |
| download | nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.tar nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.tar.gz nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.tar.bz2 nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.tar.lz nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.tar.xz nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.tar.zst nvim-treesitter-3edb01f912867603c2aef9079f208f0244c0885b.zip | |
fix(install): unlink files before copy on unix to prevent crashes (#8517)
uv_fs_copyfile will truncate the target first, which can result in
hard-to-debug crashes if the shared object is currently in use.
instead, unlink the target first, so that the operation doesn't modify
any in-use files. the disk space from the old parsers won't be reclaimed
until any processes using them relinquish their open file handles.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 30e2d2ce7..b94b31027 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -302,6 +302,8 @@ local function do_install(logger, compile_location, target_location) 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 err = uv_copyfile(compile_location, target_location) |
