From 29fddf76bc3b75224f8a974f15139627ffb435d5 Mon Sep 17 00:00:00 2001 From: Kira Kawai <66677201+ras0q@users.noreply.github.com> Date: Tue, 14 May 2024 13:04:26 +0900 Subject: [PATCH] fix(checkhealth): windows binary existence check (#3093) * :bug: Windows: allow binary without extension * show `(unknown version)` if parse failed Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com> --------- Co-authored-by: ras0q Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com> --- lua/telescope/health.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/telescope/health.lua b/lua/telescope/health.lua index a5956f4..70e5254 100644 --- a/lua/telescope/health.lua +++ b/lua/telescope/health.lua @@ -45,10 +45,12 @@ local required_plugins = { local check_binary_installed = function(package) local binaries = package.binaries or { package.name } for _, binary in ipairs(binaries) do - if is_win then + local found = vim.fn.executable(binary) == 1 + if not found and is_win then binary = binary .. ".exe" + found = vim.fn.executable(binary) == 1 end - if vim.fn.executable(binary) == 1 then + if found then local handle = io.popen(binary .. " --version") local binary_version = handle:read "*a" handle:close() @@ -101,7 +103,8 @@ M.check = function() end else local eol = version:find "\n" - ok(("%s: found %s"):format(package.name, version:sub(0, eol - 1) or "(unknown version)")) + local ver = eol and version:sub(0, eol - 1) or "(unknown version)" + ok(("%s: found %s"):format(package.name, ver)) end end end