From cb8445f8ce85d957416c106b780efd51c6298f89 Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 27 Apr 2026 06:28:19 +0200 Subject: fix(spawn): handle cases where PATH env on Windows is not set (#2080) --- lua/mason-core/spawn.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lua/mason-core/spawn.lua') diff --git a/lua/mason-core/spawn.lua b/lua/mason-core/spawn.lua index 0da67569..3c9c645d 100644 --- a/lua/mason-core/spawn.lua +++ b/lua/mason-core/spawn.lua @@ -54,12 +54,13 @@ local function Failure(err, cmd) })) end -local get_path_from_env_list = _.compose(_.strip_prefix "PATH=", _.find_first(_.starts_with "PATH=")) +local get_path_from_env_list = + _.compose(_.if_else(_.is_nil, _.identity, _.strip_prefix "PATH="), _.find_first(_.starts_with "PATH=")) ---@class SpawnArgs ---@field with_paths string[]? Paths to add to the PATH environment variable. ----@field env table? Example { SOME_ENV = "value", SOME_OTHER_ENV = "some_value" } ----@field env_raw string[]? Example: { "SOME_ENV=value", "SOME_OTHER_ENV=some_value" } +---@field env table? Environment variables to merge with the current environment. Example { SOME_ENV = "value", SOME_OTHER_ENV = "some_value" } +---@field env_raw string[]? The environment to start the process with, will not merge with the current environment. Example: { "SOME_ENV=value", "SOME_OTHER_ENV=some_value" } ---@field stdio_sink StdioSink? If provided, will be used to write to stdout and stderr. ---@field cwd string? ---@field on_spawn (fun(handle: luv_handle, stdio: luv_pipe[], pid: integer))? Will be called when the process successfully spawns. -- cgit v1.3