* Try direct command validation as final fallback.
(commands: string[])
| 142 | * Try direct command validation as final fallback. |
| 143 | */ |
| 144 | async function tryDirectCommands(commands: string[]): Promise<string | null> { |
| 145 | for (const cmd of commands) { |
| 146 | try { |
| 147 | const validated = await tryPath(cmd); |
| 148 | if (validated) { |
| 149 | return validated; |
| 150 | } |
| 151 | } catch (error) { |
| 152 | const errorMsg = error instanceof Error ? error.message : String(error); |
| 153 | logger.debug(`Direct command "${cmd}" failed: ${errorMsg}`); |
| 154 | |
| 155 | // Log permission/access errors differently |
| 156 | if ( |
| 157 | errorMsg.includes('Access is denied') || |
| 158 | errorMsg.includes('EACCES') || |
| 159 | errorMsg.includes('EPERM') |
| 160 | ) { |
| 161 | logger.warn(`Permission denied when trying Python command "${cmd}": ${errorMsg}`); |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | return null; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Attempts to get the Python executable path using platform-appropriate strategies. |
no test coverage detected
searching dependent graphs…