Skip to content

Commit f8fece7

Browse files
committed
Correctly handle non existant path in QUARTO_CHROMIUM
1 parent 7a5e65b commit f8fece7

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/command/check/check.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ async function checkInstall(conf: CheckConfiguration) {
449449
const chromiumQuarto = chromiumTool && await chromiumTool.installed()
450450
? chromiumTool
451451
: undefined;
452+
if (envPath && !safeExistsSync(envPath)) {
453+
chromeHeadlessOutput.push(
454+
`${kIndent}NOTE: QUARTO_CHROMIUM is set to ${envPath} but the path does not exist.`,
455+
);
456+
chromeJson["QUARTO_CHROMIUM_invalid"] = envPath;
457+
}
452458
if (envPath && safeExistsSync(envPath)) {
453459
chromeHeadlessOutput.push(`${kIndent}Using: Chrome from QUARTO_CHROMIUM`);
454460
chromeHeadlessOutput.push(`${kIndent}Path: ${envPath}`);

src/core/puppeteer.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,13 @@ export async function getBrowserExecutablePath() {
282282

283283
// Priority 1: QUARTO_CHROMIUM env var
284284
const envPath = Deno.env.get("QUARTO_CHROMIUM");
285-
if (envPath && safeExistsSync(envPath)) {
286-
debug(`[CHROMIUM] Using QUARTO_CHROMIUM: ${envPath}`);
287-
executablePath = envPath;
285+
if (envPath) {
286+
if (safeExistsSync(envPath)) {
287+
debug(`[CHROMIUM] Using QUARTO_CHROMIUM: ${envPath}`);
288+
executablePath = envPath;
289+
} else {
290+
debug(`[CHROMIUM] QUARTO_CHROMIUM is set to ${envPath} but the path does not exist. Searching for another browser.`);
291+
}
288292
}
289293

290294
// Priority 2: Quarto-installed chrome-headless-shell

0 commit comments

Comments
 (0)