MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / openBrowser

Function openBrowser

apps/cli/src/device-login.ts:386–399  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

384
385/** Best-effort open the verification URL in the user's default browser. */
386export 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};

Callers 2

main.tsFile · 0.90
openInBrowserFunction · 0.90

Calls 1

browserOpenCommandFunction · 0.85

Tested by

no test coverage detected