mirror of https://github.com/folke/lazy.nvim.git
parent
3d2dcb2d5e
commit
452d4eb719
|
@ -49,7 +49,7 @@ local uv = vim.loop
|
||||||
---@field on_line? fun(string)
|
---@field on_line? fun(string)
|
||||||
---@field on_exit? fun(ok:boolean, output:string)
|
---@field on_exit? fun(ok:boolean, output:string)
|
||||||
---@field timeout? number
|
---@field timeout? number
|
||||||
---@field env? string[]
|
---@field env? table<string,string>
|
||||||
|
|
||||||
---@param opts? ProcessOpts
|
---@param opts? ProcessOpts
|
||||||
---@param cmd string
|
---@param cmd string
|
||||||
|
@ -57,20 +57,15 @@ function M.spawn(cmd, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.timeout = opts.timeout or (Config.options.git and Config.options.git.timeout * 1000)
|
opts.timeout = opts.timeout or (Config.options.git and Config.options.git.timeout * 1000)
|
||||||
|
|
||||||
local env = {
|
local env = vim.tbl_extend("force", {
|
||||||
"GIT_TERMINAL_PROMPT=0",
|
GIT_SSH_COMMAND = "ssh -oBatchMode=yes",
|
||||||
"GIT_SSH_COMMAND=ssh -oBatchMode=yes",
|
}, uv.os_environ(), opts.env or {})
|
||||||
}
|
env.GIT_DIR = nil
|
||||||
if opts.env then
|
env.GIT_TERMINAL_PROMPT = "0"
|
||||||
vim.list_extend(env, opts.env)
|
|
||||||
end
|
|
||||||
|
|
||||||
for key, value in
|
local env_flat = {}
|
||||||
pairs(uv.os_environ() --[[@as string[] ]])
|
for k, v in pairs(env) do
|
||||||
do
|
env_flat[#env_flat + 1] = k .. "=" .. v
|
||||||
if key ~= "GIT_DIR" then
|
|
||||||
table.insert(env, key .. "=" .. value)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local stdout = uv.new_pipe()
|
local stdout = uv.new_pipe()
|
||||||
|
@ -95,7 +90,7 @@ function M.spawn(cmd, opts)
|
||||||
stdio = { nil, stdout, stderr },
|
stdio = { nil, stdout, stderr },
|
||||||
args = opts.args,
|
args = opts.args,
|
||||||
cwd = opts.cwd,
|
cwd = opts.cwd,
|
||||||
env = env,
|
env = env_flat,
|
||||||
}, function(exit_code, signal)
|
}, function(exit_code, signal)
|
||||||
M.running[handle] = nil
|
M.running[handle] = nil
|
||||||
if timeout then
|
if timeout then
|
||||||
|
|
Loading…
Reference in New Issue