From 3e38c303e6138dbcb0fc5b26b6773e3ef74eadce Mon Sep 17 00:00:00 2001 From: Songlin Yang <511121939@qq.com> Date: Wed, 4 Feb 2026 02:44:07 +0800 Subject: [PATCH] feat: pass env to shell command (#6863) Signed-off-by: lsytj0413 <511121939@qq.com> --- crates/goose-mcp/src/developer/shell.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/goose-mcp/src/developer/shell.rs b/crates/goose-mcp/src/developer/shell.rs index a05242833d..2e0a56b80a 100644 --- a/crates/goose-mcp/src/developer/shell.rs +++ b/crates/goose-mcp/src/developer/shell.rs @@ -8,7 +8,6 @@ use std::os::unix::process::CommandExt; pub struct ShellConfig { pub executable: String, pub args: Vec, - #[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)]