This commit is contained in:
ryanlaiwy 2026-07-14 19:16:59 -07:00 committed by GitHub
commit 8a0f7ffa91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -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

8
setup
View File

@ -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
}