aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/managers/std/init.lua5
-rw-r--r--lua/mason/health/init.lua27
2 files changed, 20 insertions, 12 deletions
diff --git a/lua/mason-core/managers/std/init.lua b/lua/mason-core/managers/std/init.lua
index 9e029664..2e699de6 100644
--- a/lua/mason-core/managers/std/init.lua
+++ b/lua/mason-core/managers/std/init.lua
@@ -79,9 +79,12 @@ end
local function win_extract(file)
local ctx = installer.context()
Result.run_catching(function()
- ctx.spawn["7z"] { "x", "-y", "-r", file }
+ ctx.spawn.gzip { "-d", file }
end)
:recover_catching(function()
+ ctx.spawn["7z"] { "x", "-y", "-r", file }
+ end)
+ :recover_catching(function()
ctx.spawn.peazip { "-ext2here", path.concat { ctx.cwd:get(), file } } -- peazip requires absolute paths
end)
:recover_catching(function()
diff --git a/lua/mason/health/init.lua b/lua/mason/health/init.lua
index 3dc325f9..342015f1 100644
--- a/lua/mason/health/init.lua
+++ b/lua/mason/health/init.lua
@@ -60,8 +60,12 @@ end
local function mk_healthcheck(callback)
---@param opts {cmd:string, args:string[], name: string, use_stderr: boolean?, version_check: fun(version: string): string?, relaxed: boolean?}
return function(opts)
- local parse_version =
- _.compose(_.head, _.split "\n", _.if_else(_.always(opts.use_stderr), _.prop "stderr", _.prop "stdout"))
+ local parse_version = _.compose(
+ _.head,
+ _.filter(_.complement(_.matches "^%s*$")),
+ _.split "\n",
+ _.if_else(_.always(opts.use_stderr), _.prop "stderr", _.prop "stdout")
+ )
---@async
return function()
@@ -214,6 +218,7 @@ function M.check()
args = { "--version" },
name = "gzip",
use_stderr = platform.is.mac, -- Apple gzip prints version string to stderr
+ relaxed = platform.is.win,
},
check { cmd = "tar", args = { "--version" }, name = "tar" },
-- when(platform.is.win, check { cmd = "powershell.exe", args = { "-Version" }, name = "PowerShell" }), -- TODO fix me
@@ -226,14 +231,12 @@ function M.check()
end
if platform.is.win then
- table.insert(
- checks,
- check { cmd = "python", use_stderr = true, args = { "--version" }, name = "python", relaxed = true }
- )
+ table.insert(checks, check { cmd = "python", args = { "--version" }, name = "python", relaxed = true })
table.insert(
checks,
check { cmd = "python", args = { "-m", "pip", "--version" }, name = "pip", relaxed = true }
)
+ table.insert(checks, check { cmd = "7z", args = { "--help" }, name = "7z", relaxed = true })
end
if vim.g.python3_host_prog then
@@ -256,11 +259,7 @@ function M.check()
)
end
- a.run_blocking(function()
- for _, c in ipairs(checks) do
- c()
- end
-
+ table.insert(checks, function()
github_client
.fetch_rate_limit()
:map(
@@ -293,6 +292,12 @@ function M.check()
health.report_warn "Failed to check GitHub API rate limit status."
end)
end)
+
+ a.run_blocking(function()
+ for _, c in ipairs(checks) do
+ c()
+ end
+ end)
end
return M