feat: pass env to shell command (#6863)

Signed-off-by: lsytj0413 <511121939@qq.com>
This commit is contained in:
Songlin Yang
2026-02-04 02:44:07 +08:00
committed by GitHub
parent aa356bd460
commit 3e38c303e6
+7 -3
View File
@@ -8,7 +8,6 @@ use std::os::unix::process::CommandExt;
pub struct ShellConfig {
pub executable: String,
pub args: Vec<String>,
#[allow(dead_code)]
pub envs: Vec<(OsString, OsString)>,
}
@@ -129,8 +128,13 @@ pub fn configure_shell_command(
.env("EDITOR", "sh -c 'echo \"Interactive editor not available in this environment.\" >&2; exit 1'")
.env("GIT_TERMINAL_PROMPT", "0")
.env("GIT_PAGER", "cat")
.args(&shell_config.args)
.arg(command);
.args(&shell_config.args);
for (key, value) in &shell_config.envs {
command_builder.env(key, value);
}
command_builder.arg(command);
// On Unix systems, create a new process group so we can kill child processes
#[cfg(unix)]