From 2fc5fd23dace3626f4daec1e9cbefa58a2d9a7bd Mon Sep 17 00:00:00 2001 From: Max Novich Date: Wed, 5 Feb 2025 21:48:30 -0800 Subject: [PATCH] fix issue with listing dir --- crates/goose-mcp/src/developer/shell.rs | 32 ++++++------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/crates/goose-mcp/src/developer/shell.rs b/crates/goose-mcp/src/developer/shell.rs index 0dc70e081..b323395e7 100644 --- a/crates/goose-mcp/src/developer/shell.rs +++ b/crates/goose-mcp/src/developer/shell.rs @@ -10,24 +10,11 @@ pub struct ShellConfig { impl Default for ShellConfig { fn default() -> Self { if cfg!(windows) { - // Prefer PowerShell over cmd.exe for better functionality - if std::process::Command::new("powershell.exe") - .arg("-Command") - .arg("exit") - .output() - .is_ok() - { - Self { - executable: "powershell.exe".to_string(), - arg: "-Command".to_string(), - redirect_syntax: "2>&1".to_string(), // PowerShell supports Unix-style redirection - } - } else { - Self { - executable: "cmd.exe".to_string(), - arg: "/C".to_string(), - redirect_syntax: "2>&1".to_string(), // cmd.exe also supports this syntax - } + // Use cmd.exe for simpler command execution + Self { + executable: "cmd.exe".to_string(), + arg: "/C".to_string(), + redirect_syntax: "2>&1".to_string(), // cmd.exe also supports this syntax } } else { Self { @@ -45,13 +32,8 @@ pub fn get_shell_config() -> ShellConfig { pub fn format_command_for_platform(command: &str) -> String { let config = get_shell_config(); - if cfg!(windows) && config.executable == "powershell.exe" { - // For Windows PowerShell, wrap the command in braces - format!("{{ {} }} {}", command, config.redirect_syntax) - } else { - // For cmd.exe and Unix shells, no braces needed - format!("{} {}", command, config.redirect_syntax) - } + // For all shells, no braces needed + format!("{} {}", command, config.redirect_syntax) } pub fn expand_path(path_str: &str) -> String {