diff --git a/browse/src/browser-manager.ts b/browse/src/browser-manager.ts index f9f3317b5..f1703ae92 100644 --- a/browse/src/browser-manager.ts +++ b/browse/src/browser-manager.ts @@ -371,6 +371,12 @@ export class BrowserManager { this.browser = await chromium.launch({ headless: useHeadless, + // Honor GSTACK_CHROMIUM_PATH on the headless launch path. The headed + // path (launchPersistentContext, below) already respects it; this keeps + // both modes consistent for custom Chromium builds — e.g. a NixOS system + // binary, where Playwright's bundled chrome-headless-shell can't run. + // No-op when the env var is unset. + ...(process.env.GSTACK_CHROMIUM_PATH ? { executablePath: process.env.GSTACK_CHROMIUM_PATH } : {}), // 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. Also disabled diff --git a/setup b/setup index 275236cd3..5e51d97c6 100755 --- a/setup +++ b/setup @@ -260,7 +260,13 @@ ensure_playwright_browser() { else ( cd "$SOURCE_GSTACK_DIR" - bun --eval 'import { chromium } from "playwright"; const browser = await chromium.launch(); await browser.close();' + if [ -n "$GSTACK_CHROMIUM_PATH" ]; then + # GSTACK_CHROMIUM_PATH set: verify that custom Chromium instead (e.g. a + # NixOS system binary, where Playwright's bundled Chromium can't run). + bun --eval 'import { chromium } from "playwright"; const browser = await chromium.launch({ executablePath: process.env.GSTACK_CHROMIUM_PATH, args: ["--no-sandbox"] }); await browser.close();' + else + bun --eval 'import { chromium } from "playwright"; const browser = await chromium.launch(); await browser.close();' + fi ) >/dev/null 2>&1 fi }