(url: string)
| 384 | |
| 385 | /** Best-effort open the verification URL in the user's default browser. */ |
| 386 | export const openBrowser = (url: string): void => { |
| 387 | const openCommand = browserOpenCommand(url); |
| 388 | if (!openCommand) return; |
| 389 | const [command, args] = openCommand; |
| 390 | try { |
| 391 | const child = spawn(command, args, { stdio: "ignore", detached: true }); |
| 392 | // Swallow async spawn failures (e.g. the opener binary is missing), the |
| 393 | // URL is printed too, so the user can open it by hand. |
| 394 | (child as { on?: (event: "error", listener: () => void) => void }).on?.("error", () => {}); |
| 395 | child.unref(); |
| 396 | } catch { |
| 397 | // Ignore, the URL is also printed for manual opening. |
| 398 | } |
| 399 | }; |
no test coverage detected