Skip to content

Commit

Permalink
fix(checkhealth): windows binary existence check (#3093)
Browse files Browse the repository at this point in the history
* 🐛 Windows: allow binary without extension

* show `(unknown version)` if parse failed

Co-authored-by: James Trew <[email protected]>

---------

Co-authored-by: ras0q <[email protected]>
Co-authored-by: James Trew <[email protected]>
  • Loading branch information
3 people committed May 14, 2024
1 parent c8b69ca commit 29fddf7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lua/telescope/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 29fddf7

Please sign in to comment.