UNPKG

longcelot-sheet-db

Version:

Google Sheets-backed staging database adapter for Node.js with schema-first design

26 lines 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.openBrowser = openBrowser; const child_process_1 = require("child_process"); /** * Best-effort: opens `url` in the user's default browser. Never throws and never blocks the * OAuth flow — every failure mode (missing `xdg-open` in a minimal container, headless CI, an * unrecognized platform) is swallowed, because the caller has already printed the URL for the * user to open by hand as the fallback. */ function openBrowser(url) { try { const platform = process.platform; const cmd = platform === 'darwin' ? 'open' : platform === 'win32' ? 'cmd' : 'xdg-open'; const args = platform === 'win32' ? ['/c', 'start', '""', url] : [url]; const child = (0, child_process_1.spawn)(cmd, args, { stdio: 'ignore', detached: true }); child.on('error', () => { // e.g. `xdg-open` not installed — the printed URL above is the fallback. }); child.unref(); } catch { // never let a browser-launch failure interrupt the auth flow } } //# sourceMappingURL=browser.js.map