commit 2f95abddfaf8921555a7e252fc77ed26cbb4de5c
parent 1c52e90cd57c0ae3a289701fb658061a511a6756
Author: Tom Ampuero <46233260+tampueroc@users.noreply.github.com>
Date: Sun, 29 Jun 2025 15:56:44 +0100
refactor(health): use vim.system():wait() #34702
Problem:
- The ripgrep probe still used the legacy `vim.fn.system()`
Solution:
- Replace `vim.fn.system()` with `vim.system({rg_path, '-V'}):wait()`
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/runtime/lua/vim/health/health.lua b/runtime/lua/vim/health/health.lua
@@ -399,10 +399,13 @@ local function check_external_tools()
health.start('External Tools')
if vim.fn.executable('rg') == 1 then
- local rg = vim.fn.exepath('rg')
- local cmd = 'rg -V'
- local out = vim.fn.system(vim.fn.split(cmd))
- health.ok(('%s (%s)'):format(vim.trim(out), rg))
+ local rg_path = vim.fn.exepath('rg')
+ local rg_job = vim.system({ rg_path, '-V' }):wait()
+ if rg_job.code == 0 then
+ health.ok(('%s (%s)'):format(vim.trim(rg_job.stdout), rg_path))
+ else
+ health.warn('found `rg` but failed to run `rg -V`', { rg_job.stderr })
+ end
else
health.warn('ripgrep not available')
end