aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2026-04-27 06:28:19 +0200
committerGitHub <noreply@github.com>2026-04-27 06:28:19 +0200
commitcb8445f8ce85d957416c106b780efd51c6298f89 (patch)
tree58bd8600ba61509ba4181551befaaed4d00fa225 /lua
parentfix(powershell): conform to single quotes (#1740) (diff)
downloadmason-cb8445f8ce85d957416c106b780efd51c6298f89.tar
mason-cb8445f8ce85d957416c106b780efd51c6298f89.tar.gz
mason-cb8445f8ce85d957416c106b780efd51c6298f89.tar.bz2
mason-cb8445f8ce85d957416c106b780efd51c6298f89.tar.lz
mason-cb8445f8ce85d957416c106b780efd51c6298f89.tar.xz
mason-cb8445f8ce85d957416c106b780efd51c6298f89.tar.zst
mason-cb8445f8ce85d957416c106b780efd51c6298f89.zip
fix(spawn): handle cases where PATH env on Windows is not set (#2080)HEADmain
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/spawn.lua7
1 files changed, 4 insertions, 3 deletions
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<string, string>? 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<string, string>? 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.