feat: pass env to shell command (#6863)
Signed-off-by: lsytj0413 <511121939@qq.com>
This commit is contained in:
@@ -8,7 +8,6 @@ use std::os::unix::process::CommandExt;
|
|||||||
pub struct ShellConfig {
|
pub struct ShellConfig {
|
||||||
pub executable: String,
|
pub executable: String,
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
#[allow(dead_code)]
|
|
||||||
pub envs: Vec<(OsString, OsString)>,
|
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("EDITOR", "sh -c 'echo \"Interactive editor not available in this environment.\" >&2; exit 1'")
|
||||||
.env("GIT_TERMINAL_PROMPT", "0")
|
.env("GIT_TERMINAL_PROMPT", "0")
|
||||||
.env("GIT_PAGER", "cat")
|
.env("GIT_PAGER", "cat")
|
||||||
.args(&shell_config.args)
|
.args(&shell_config.args);
|
||||||
.arg(command);
|
|
||||||
|
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
|
// On Unix systems, create a new process group so we can kill child processes
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
|||||||
Reference in New Issue
Block a user