"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.openUrl = openUrl;
const spawn_1 = require("../utils/spawn");
function openUrl(url) {
    const command = process.platform === 'win32'
        ? { name: 'cmd', args: ['/c', 'start', '', url] }
        : process.platform === 'darwin'
            ? { name: 'open', args: [url] }
            : { name: 'xdg-open', args: [url] };
    const result = (0, spawn_1.spawnCommand)(command.name, command.args, {
        encoding: 'utf8',
        stdio: 'ignore',
        timeout: 30000
    });
    if (result.error) {
        throw result.error;
    }
    if (result.status !== 0) {
        throw new Error(`Failed to open ${url}`);
    }
}
//# sourceMappingURL=browser-opener.js.map