(command: string)
| 34 | * command name there). |
| 35 | */ |
| 36 | export async function resolveCommandViaLoginShell(command: string): Promise<string | null> { |
| 37 | if (!SAFE_COMMAND.test(command)) return null |
| 38 | if (process.platform === 'win32') return null |
| 39 | |
| 40 | const cached = cache.get(command) |
| 41 | if (cached && Date.now() - cached.at < RESOLUTION_TTL_MS) return cached.value |
| 42 | |
| 43 | const value = await queryLoginShell(command) |
| 44 | cache.set(command, { at: Date.now(), value }) |
| 45 | return value |
| 46 | } |
| 47 | |
| 48 | async function queryLoginShell(command: string): Promise<string | null> { |
| 49 | // Try the user's own shell first, then the standard POSIX shells. On |
no test coverage detected