(url: string)
| 335 | |
| 336 | /** Best-effort open the verification URL in the user's default browser. */ |
| 337 | export const openBrowser = (url: string): void => { |
| 338 | const openCommand = browserOpenCommand(url); |
| 339 | if (!openCommand) return; |
| 340 | const [command, args] = openCommand; |
| 341 | try { |
| 342 | const child = spawn(command, args, { stdio: "ignore", detached: true }); |
| 343 | // Swallow async spawn failures (e.g. the opener binary is missing), the |
| 344 | // URL is printed too, so the user can open it by hand. |
| 345 | (child as { on?: (event: "error", listener: () => void) => void }).on?.("error", () => {}); |
| 346 | child.unref(); |
| 347 | } catch { |
| 348 | // Ignore, the URL is also printed for manual opening. |
| 349 | } |
| 350 | }; |
no test coverage detected