| 654 | } |
| 655 | |
| 656 | function resolvePathExtensions(): string[] { |
| 657 | if (process.platform !== 'win32') return ['']; |
| 658 | const rawPathExt = process.env.PATHEXT; |
| 659 | if (!rawPathExt) return WINDOWS_PATH_EXTENSIONS; |
| 660 | const extensions = rawPathExt |
| 661 | .split(';') |
| 662 | .map((value) => value.trim().toLowerCase()) |
| 663 | .filter((value) => value.length > 0); |
| 664 | return extensions.length > 0 ? extensions : WINDOWS_PATH_EXTENSIONS; |
| 665 | } |
| 666 | |
| 667 | function resolveExecutableCandidates(cmd: string, pathExtensions: string[]): string[] { |
| 668 | if (process.platform !== 'win32') return [cmd]; |