From 184477dbba48cf12f80207415ef21ef761565bbe Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 15 Oct 2021 22:05:19 +0200 Subject: process: avoid duplicate env entries (#155) Resolves #123. --- lua/nvim-lsp-installer/process.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lua/nvim-lsp-installer/process.lua') diff --git a/lua/nvim-lsp-installer/process.lua b/lua/nvim-lsp-installer/process.lua index f81ba8cb..1b272f65 100644 --- a/lua/nvim-lsp-installer/process.lua +++ b/lua/nvim-lsp-installer/process.lua @@ -34,14 +34,16 @@ function M.extend_path(new_paths) end function M.graft_env(env) - local root_env = {} + local merged_env = {} for key, val in pairs(initial_environ) do - root_env[#root_env + 1] = key .. "=" .. val + if env[key] == nil then + merged_env[#merged_env + 1] = key .. "=" .. val + end end for key, val in pairs(env) do - root_env[#root_env + 1] = key .. "=" .. val + merged_env[#merged_env + 1] = key .. "=" .. val end - return root_env + return merged_env end local function sanitize_env_list(env_list) -- cgit v1.2.3-70-g09d2