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

Function openBrowser

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

Source from the content-addressed store, hash-verified

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

Callers 2

main.tsFile · 0.90
openInBrowserFunction · 0.90

Calls 1

browserOpenCommandFunction · 0.85

Tested by

no test coverage detected