openBrowser
uses node:child_process
Open a URL in the browser: $BROWSER if it's set (the URL its last argument), else the system's.
import { browserCommand } from "#codebase/tcmts/atproto"; import { spawn } from "node:child_process"; export function openBrowser(url: string): void { const b = process.env.BROWSER; const [cmd, args] = browserCommand(url, process.platform, b); const c = spawn(cmd, args, { stdio: "ignore", detached: !b }); c.on("error", () => undefined); c.unref(); }