diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs index 5cdff8654f..26e96789a0 100644 --- a/crates/languages/src/python.rs +++ b/crates/languages/src/python.rs @@ -1259,7 +1259,7 @@ fn micromamba_shell_name(kind: ShellKind) -> &'static str { ShellKind::Csh => "csh", ShellKind::Fish => "fish", ShellKind::Nushell => "nu", - ShellKind::PowerShell => "powershell", + ShellKind::PowerShell | ShellKind::Pwsh => "powershell", ShellKind::Cmd => "cmd.exe", // default / catch-all: _ => "posix", @@ -1470,9 +1470,17 @@ impl ToolchainLister for PythonToolchainProvider { // Activate micromamba shell in the child shell // [required for micromamba] if manager == "micromamba" { - let shell = micromamba_shell_name(shell); - activation_script - .push(format!(r#"eval "$({manager} shell hook --shell {shell})""#)); + match shell { + ShellKind::PowerShell | ShellKind::Pwsh => { + activation_script.push(format!(r#"(& {manager} shell hook --shell powershell) | Out-String | Invoke-Expression"#)); + } + _ => { + let shell_name = micromamba_shell_name(shell); + activation_script.push(format!( + r#"eval "$({manager} shell hook --shell {shell_name})""# + )); + } + } } if let Some(name) = &toolchain.environment.name {