diff --git a/browse/src/browser-manager.ts b/browse/src/browser-manager.ts index 32f5ab769..c37b0f564 100644 --- a/browse/src/browser-manager.ts +++ b/browse/src/browser-manager.ts @@ -312,6 +312,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 631b84003..eacfc1ef1 100755 --- a/setup +++ b/setup @@ -256,7 +256,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 }