shell: Correctly identifiy powershell shells on windows (#43526)
Release Notes: - Fixed zed only finding pwsh but not powershell on windows
This commit is contained in:
@@ -204,14 +204,22 @@ pub fn get_windows_system_shell() -> String {
|
||||
}
|
||||
|
||||
static SYSTEM_SHELL: LazyLock<String> = LazyLock::new(|| {
|
||||
find_pwsh_in_programfiles(false, false)
|
||||
.or_else(|| find_pwsh_in_programfiles(true, false))
|
||||
.or_else(|| find_pwsh_in_msix(false))
|
||||
.or_else(|| find_pwsh_in_programfiles(false, true))
|
||||
.or_else(|| find_pwsh_in_msix(true))
|
||||
.or_else(|| find_pwsh_in_programfiles(true, true))
|
||||
.or_else(find_pwsh_in_scoop)
|
||||
.map(|p| p.to_string_lossy().into_owned())
|
||||
let locations = [
|
||||
|| find_pwsh_in_programfiles(false, false),
|
||||
|| find_pwsh_in_programfiles(true, false),
|
||||
|| find_pwsh_in_msix(false),
|
||||
|| find_pwsh_in_programfiles(false, true),
|
||||
|| find_pwsh_in_msix(true),
|
||||
|| find_pwsh_in_programfiles(true, true),
|
||||
|| find_pwsh_in_scoop(),
|
||||
|| which::which_global("pwsh.exe").ok(),
|
||||
|| which::which_global("powershell.exe").ok(),
|
||||
];
|
||||
|
||||
locations
|
||||
.into_iter()
|
||||
.find_map(|f| f())
|
||||
.map(|p| p.to_string_lossy().trim().to_owned())
|
||||
.inspect(|shell| log::info!("Found powershell in: {}", shell))
|
||||
.unwrap_or_else(|| {
|
||||
log::warn!("Powershell not found, falling back to `cmd`");
|
||||
|
||||
Reference in New Issue
Block a user