fix: check also fdfind in healthcheck (#1318)

Support different binary names when checking if fd is installed.
This commit is contained in:
Jakub Łuczyński
2021-10-09 15:34:08 +02:00
committed by GitHub
parent 50e45f86d9
commit 917500dbe9

View File

@@ -25,6 +25,7 @@ local optional_dependencies = {
package = {
{
name = "fd",
binaries = { "fd", "fdfind" },
url = "[sharkdp/fd](https://github.com/sharkdp/fd)",
optional = true,
},
@@ -42,16 +43,18 @@ local required_plugins = {
}
local check_binary_installed = function(package)
local file_extension = is_win and ".exe" or ""
local filename = package.name .. file_extension
if fn.executable(filename) == 0 then
return
else
local handle = io.popen(filename .. " --version")
local binaries = package.binaries or { package.name }
for _, binary in ipairs(binaries) do
if is_win then
binary = binary .. ".exe"
end
if fn.executable(binary) == 1 then
local handle = io.popen(binary .. " --version")
local binary_version = handle:read "*a"
handle:close()
return true, binary_version
end
end
end
local function lualib_installed(lib_name)