( whichCommand: LinuxToolAvailabilityChecker, config: LocalLinuxToolConfig<T>, )
| 288 | }; |
| 289 | |
| 290 | async function resolveLocalLinuxTool<T extends string>( |
| 291 | whichCommand: LinuxToolAvailabilityChecker, |
| 292 | config: LocalLinuxToolConfig<T>, |
| 293 | ): Promise<T> { |
| 294 | const display = isLinuxWayland() ? 'wayland' : 'x11'; |
| 295 | for (const candidate of config[display]) { |
| 296 | if (await whichCommand(candidate.command)) return candidate.tool; |
| 297 | } |
| 298 | throw new AppError('TOOL_MISSING', display === 'wayland' ? config.waylandError : config.x11Error); |
| 299 | } |
| 300 | |
| 301 | function isLinuxWayland(): boolean { |
| 302 | return Boolean(process.env['WAYLAND_DISPLAY']) || process.env['XDG_SESSION_TYPE'] === 'wayland'; |
no test coverage detected