Files
orca/src/main/providers/windows-powershell.ts
T
SSWSer 6f606114a0 feat: add PowerShell 7+ support for Windows terminals
Adds PowerShell 7+ support for Windows terminal selection, with Auto resolving to pwsh.exe when available and falling back to Windows PowerShell.
2026-05-02 16:06:11 -07:00

28 lines
859 B
TypeScript

export type WindowsPowerShellImplementation = 'auto' | 'powershell.exe' | 'pwsh.exe'
/** Resolve which PowerShell executable to spawn right now on Windows.
*
* Why: keep the saved pwsh preference intact even when pwsh is temporarily
* unavailable, so runtime falls back safely without mutating user settings.
*/
export function resolveEffectiveWindowsPowerShell(args: {
shellFamily: 'powershell.exe' | 'cmd.exe' | 'wsl.exe' | undefined
implementation: WindowsPowerShellImplementation | undefined
pwshAvailable: boolean
}): 'powershell.exe' | 'pwsh.exe' | null {
if (args.shellFamily !== 'powershell.exe') {
return null
}
if (
(args.implementation === undefined ||
args.implementation === 'auto' ||
args.implementation === 'pwsh.exe') &&
args.pwshAvailable
) {
return 'pwsh.exe'
}
return 'powershell.exe'
}