mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 11:45:20 +02:00
fix: disable Chromium sandbox on Windows
Chromium's sandbox fails when the server is spawned through the Bun→Node process chain on Windows (GitHub #276). Disable chromiumSandbox on Windows at both launch sites (headless + headed). Safe: local daemon browsing user-specified URLs, Playwright docs recommend disabling in CI/container environments. Fixes #276. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,13 @@ export class BrowserManager {
|
||||
private consecutiveFailures: number = 0;
|
||||
|
||||
async launch() {
|
||||
this.browser = await chromium.launch({ headless: true });
|
||||
this.browser = await chromium.launch({
|
||||
headless: true,
|
||||
// On Windows, Chromium's sandbox fails when the server is spawned through
|
||||
// the Bun→Node process chain (GitHub #276). Disable it — local daemon
|
||||
// browsing user-specified URLs has marginal sandbox benefit.
|
||||
chromiumSandbox: process.platform !== 'win32',
|
||||
});
|
||||
|
||||
// Chromium crash → exit with clear message
|
||||
this.browser.on('disconnected', () => {
|
||||
@@ -464,7 +470,11 @@ export class BrowserManager {
|
||||
// 2. Launch new headed browser (try-catch — if this fails, headless stays running)
|
||||
let newBrowser: Browser;
|
||||
try {
|
||||
newBrowser = await chromium.launch({ headless: false, timeout: 15000 });
|
||||
newBrowser = await chromium.launch({
|
||||
headless: false,
|
||||
timeout: 15000,
|
||||
chromiumSandbox: process.platform !== 'win32',
|
||||
});
|
||||
} catch (err: unknown) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
return `ERROR: Cannot open headed browser — ${msg}. Headless browser still running.`;
|
||||
|
||||
Reference in New Issue
Block a user