From 2f95abddfaf8921555a7e252fc77ed26cbb4de5c Mon Sep 17 00:00:00 2001 From: Tom Ampuero <46233260+tampueroc@users.noreply.github.com> Date: Sun, 29 Jun 2025 15:56:44 +0100 Subject: [PATCH] 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()` --- runtime/lua/vim/health/health.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/lua/vim/health/health.lua b/runtime/lua/vim/health/health.lua index dd6fe7f608..14bc7b53e5 100644 --- 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