Skip to content

Commit f0403e1

Browse files
committed
cri - Allow user to set the headless through an env var
1 parent 1057712 commit f0403e1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/cri/cri.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { findOpenPort } from "../port.ts";
1414
import { getNamedLifetime, ObjectWithLifetime } from "../lifetimes.ts";
1515
import { sleep } from "../async.ts";
1616
import { InternalError } from "../lib/error.ts";
17+
import { getenv } from "../env.ts";
1718
import { kRenderFileLifetime } from "../../config/constants.ts";
1819

1920
async function waitForServer(port: number, timeout = 3000) {
@@ -78,6 +79,9 @@ export async function criClient(appPath?: string, port?: number) {
7879
}
7980
const app: string = appPath || await getBrowserExecutablePath();
8081

82+
// Allow to adapt the headless mode depending on the Chrome version
83+
const headlessMode = getenv("QUARTO_CHROME_HEADLESS_MODE", "old");
84+
8185
const cmd = [
8286
app,
8387
// TODO: Chrome v128 changed the default from --headless=old to --headless=new
@@ -88,7 +92,7 @@ export async function criClient(appPath?: string, port?: number) {
8892
// move to the new mode. We'll use `--headless=old` as the default for now
8993
// until the new mode is more stable, or until we really pin a version as default to be used.
9094
// This is also impacting in chromote and pagedown R packages and we could keep syncing with them.
91-
"--headless=old",
95+
`--headless${headlessMode ? "=" + headlessMode : ""}`,
9296
"--no-sandbox",
9397
"--disable-gpu",
9498
"--renderer-process-limit=1",

0 commit comments

Comments
 (0)