Skip to content

Commit d629028

Browse files
committed
cri - add debug() log message to help know how chromium is detected
1 parent d60c487 commit d629028

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/core/puppeteer.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { readRegistryKey } from "./windows.ts";
88
import { safeExistsSync, which } from "./path.ts";
9-
import { error, info } from "../deno_ral/log.ts";
9+
import { debug, error, info } from "../deno_ral/log.ts";
1010
import { existsSync } from "../deno_ral/fs.ts";
1111
import { UnreachableError } from "./lib/error.ts";
1212
import { quartoDataDir } from "./appdirs.ts";
@@ -204,6 +204,8 @@ async function findChrome(): Promise<string | undefined> {
204204
// First check env var and use this path if specified
205205
const envPath = Deno.env.get("QUARTO_CHROMIUM");
206206
if (envPath && safeExistsSync(envPath)) {
207+
debug("[CHROMIUM] Using path specified in QUARTO_CHROMIUM");
208+
debug(`[CHROMIUM] Path: ${envPath}`);
207209
return envPath;
208210
}
209211
// Otherwise, try to find the path based on OS.
@@ -212,7 +214,7 @@ async function findChrome(): Promise<string | undefined> {
212214
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
213215
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
214216
];
215-
return programs.find(safeExistsSync);
217+
path = programs.find(safeExistsSync);
216218
} else if (Deno.build.os === "windows") {
217219
// Try the HKLM key
218220
const programs = ["chrome.exe", "msedge.exe"];
@@ -222,7 +224,7 @@ async function findChrome(): Promise<string | undefined> {
222224
programs[i],
223225
"(Default)",
224226
);
225-
if (path && existsSync(path)) break;
227+
if (path && safeExistsSync(path)) break;
226228
}
227229

228230
// Try the HKCR key
@@ -246,6 +248,12 @@ async function findChrome(): Promise<string | undefined> {
246248
path = await which("chromium-browser");
247249
}
248250
}
251+
if (path) {
252+
debug("[CHROMIUM] Found Chromium on OS known location");
253+
debug(`[CHROMIUM] Path: ${path}`);
254+
} else {
255+
debug("[CHROMIUM] Chromium not found on OS known location");
256+
}
249257
return path;
250258
}
251259

0 commit comments

Comments
 (0)