MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getPowerShellEdition

Function getPowerShellEdition

src/utils/shell/powershellDetection.ts:87–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 * `&&` on 7+ where it's the correct short-circuiting operator.
86 */
87export async function getPowerShellEdition(): Promise<PowerShellEdition | null> {
88 const p = await getCachedPowerShellPath()
89 if (!p) return null
90 // basename without extension, case-insensitive. Covers:
91 // C:\Program Files\PowerShell\7\pwsh.exe
92 // /opt/microsoft/powershell/7/pwsh
93 // C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
94 const base = p
95 .split(/[/\\]/)
96 .pop()!
97 .toLowerCase()
98 .replace(/\.exe$/, '')
99 return base === 'pwsh' ? 'core' : 'desktop'
100}
101
102/**
103 * Resets the cached PowerShell path. Only for testing.

Callers 1

getPromptFunction · 0.85

Calls 2

getCachedPowerShellPathFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected