MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / findPowerShell

Function findPowerShell

Extension/src/common.ts:1440–1458  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1438 * Find PowerShell executable from PATH (for Windows only).
1439 */
1440export function findPowerShell(): string | undefined {
1441 const dirs: string[] = (process.env.PATH || '').replace(/"+/g, '').split(';').filter(x => x);
1442 const exts: string[] = (process.env.PATHEXT || '').split(';');
1443 const names: string[] = ['pwsh', 'powershell'];
1444 for (const name of names) {
1445 const candidates: string[] = dirs.reduce<string[]>((paths, dir) => [
1446 ...paths, ...exts.map(ext => path.join(dir, name + ext))
1447 ], []);
1448 for (const candidate of candidates) {
1449 try {
1450 if (fs.statSync(candidate).isFile()) {
1451 return name;
1452 }
1453 } catch {
1454 // ignore, try next candidate
1455 }
1456 }
1457 }
1458}
1459
1460export function getCppToolsTargetPopulation(): TargetPopulation {
1461 // If insiders.flag is present, consider this an insiders build.

Callers 1

GetMethod · 0.90

Calls 2

filterMethod · 0.45
isFileMethod · 0.45

Tested by

no test coverage detected