()
| 170 | * @returns The Python executable path if successful, or null if failed. |
| 171 | */ |
| 172 | export async function getSysExecutable(): Promise<string | null> { |
| 173 | if (process.platform === 'win32') { |
| 174 | // Windows: Try 'where python' first to avoid Microsoft Store stubs |
| 175 | const whereResult = await tryWindowsWhere(); |
| 176 | if (whereResult) { |
| 177 | return whereResult; |
| 178 | } |
| 179 | |
| 180 | // Then try py launcher commands (removing python3 as it's uncommon on Windows) |
| 181 | const sysResult = await tryPythonCommands(['py', 'py -3']); |
| 182 | if (sysResult) { |
| 183 | return sysResult; |
| 184 | } |
| 185 | |
| 186 | // Final fallback to direct python command |
| 187 | return await tryDirectCommands(['python']); |
| 188 | } else { |
| 189 | // Unix: Standard python3/python detection |
| 190 | return await tryPythonCommands(['python3', 'python']); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Attempts to validate a Python executable path. |
no test coverage detected
searching dependent graphs…