MCPcopy Create free account
hub / github.com/garrytan/gstack / openBrowser

Function openBrowser

design/src/cli.ts:364–379  ·  view source on GitHub ↗

Open a URL in the default browser. Stays cross-platform with serve.ts.

(url: string)

Source from the content-addressed store, hash-verified

362
363/** Open a URL in the default browser. Stays cross-platform with serve.ts. */
364function openBrowser(url: string): void {
365 const platform = process.platform;
366 let cmd: string;
367 if (platform === "darwin") cmd = "open";
368 else if (platform === "linux") cmd = "xdg-open";
369 else {
370 console.error(`Open this URL in your browser: ${url}`);
371 return;
372 }
373 try {
374 const child = nodeSpawn(cmd, [url], { stdio: "ignore", detached: true });
375 child.unref();
376 } catch {
377 console.error(`Open this URL in your browser: ${url}`);
378 }
379}
380
381/**
382 * Resolve image paths from a glob pattern or comma-separated list.

Callers 1

publishToDaemonFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected