Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conda environment shell output capture #1117

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 7 additions & 5 deletions crates/goose-mcp/src/developer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,13 @@ impl DeveloperRouter {
"The command string is required".to_string(),
))?;

// TODO consider command suggestions and safety rails

// TODO be more careful about backgrounding, revisit interleave
// Redirect stderr to stdout to interleave outputs
let cmd_with_redirect = format!("{} 2>&1", command);
// Detect if the command is to be run within a conda environment
let conda_env = std::env::var("CONDA_DEFAULT_ENV").ok();
let cmd_with_redirect = if let Some(env) = conda_env {
format!("conda run -n {} {} 2>&1", env, command)
} else {
format!("{} 2>&1", command)
};

// Execute the command
let child = Command::new("bash")
Expand Down