Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions crates/goose-mcp/src/developer/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,25 @@ impl Default for ShellConfig {
}
#[cfg(not(windows))]
{
let bash_env = get_config_dir().join(".bash_env").into_os_string();
let shell = env::var("SHELL").unwrap_or_else(|_| "bash".to_string());
// Get just the shell name from the path (e.g., /bin/zsh -> zsh)
let shell_name = std::path::Path::new(&shell)
.file_name()
.and_then(|s| s.to_str())
.unwrap_or("bash");

// Configure environment based on shell type
let envs = if shell_name == "bash" {
let bash_env = get_config_dir().join(".bash_env").into_os_string();
vec![(OsString::from("BASH_ENV"), bash_env)]
} else {
vec![]
};

Self {
executable: "bash".to_string(),
args: vec!["-c".to_string()],
envs: vec![(OsString::from("BASH_ENV"), bash_env)],
executable: shell,
args: vec!["-c".to_string()], // -c is standard across bash/zsh/fish
envs,
}
}
}
Expand Down
Loading