util: Fall back to cmd if we can't find powershell on the system (#42204)

Closes https://github.com/zed-industries/zed/issues/42165

Release Notes:

- Fixed trying to use powershell for commands when its not installed on
the system
This commit is contained in:
Lukas Wirth
2025-11-07 17:13:52 +01:00
committed by GitHub
parent 9591790d8d
commit 083bd147ef
2 changed files with 5 additions and 2 deletions
+5 -1
View File
@@ -199,7 +199,11 @@ pub fn get_windows_system_shell() -> String {
.or_else(|| find_pwsh_in_programfiles(true, true))
.or_else(find_pwsh_in_scoop)
.map(|p| p.to_string_lossy().into_owned())
.unwrap_or("powershell.exe".to_string())
.inspect(|shell| log::info!("Found powershell in: {}", shell))
.unwrap_or_else(|| {
log::warn!("Powershell not found, falling back to `cmd`");
"cmd.exe".to_string()
})
});
(*SYSTEM_SHELL).clone()