mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
fix(cli): keep doctor resilient to a corrupt browser cache (#1822)
* fix(cli): keep doctor resilient to a corrupt browser cache A partial or corrupt browser cache (a stub file where a version directory is expected, a missing executable, or malformed metadata) makes getInstalledBrowsers throw ENOTDIR. That throw propagated up through findBrowser -> checkChrome -> runEnvironmentChecks, and since doctor.run calls runEnvironmentChecks before any try/catch or the --json output, the command crashed with exit 1. doctor --json is documented to exit 0 even when checks fail, so it must report a corrupt cache as "Chrome not found", not crash on it. - checkChrome now catches any error from findBrowser and converts it to the existing ok:false "Chrome not found" outcome with the browser ensure hint, so runEnvironmentChecks never throws for a missing or corrupt browser. - findFromCache treats a throwing getInstalledBrowsers as "no cached browser", letting resolution fall through to system/download instead of crashing every caller (render included), not just doctor. A healthy browser still reports ok:true. Adds a preflight test asserting an ok:false Chrome outcome when discovery throws, instead of propagating. * fix(cli): warn on corrupt browser cache fallback
This commit is contained in:
@@ -139,7 +139,17 @@ async function checkChrome(browserPath?: string): Promise<EnvironmentCheckOutcom
|
||||
};
|
||||
}
|
||||
|
||||
const info = await findBrowser();
|
||||
// A corrupt/partial browser cache (stub files where a version dir is
|
||||
// expected, missing executable, malformed metadata) makes findBrowser throw.
|
||||
// That is the exact condition this check exists to report, so treat any
|
||||
// failure as "Chrome not found" rather than letting it crash the caller
|
||||
// (notably `doctor`, which is documented to exit 0 even when checks fail).
|
||||
let info: Awaited<ReturnType<typeof findBrowser>>;
|
||||
try {
|
||||
info = await findBrowser();
|
||||
} catch {
|
||||
info = undefined;
|
||||
}
|
||||
if (info) {
|
||||
return {
|
||||
name: "Chrome",
|
||||
|
||||
Reference in New Issue
Block a user