Skip to content

Commit 64e3735

Browse files
authored
fix(cli): doctor shows platform-correct install hints (heygen-com#319)
The "FFmpeg not found" hint was hardcoded to `sudo apt install ffmpeg` for any non-macOS platform — Windows users would see an apt command that doesn't exist on their system, and Red Hat / Arch users got the wrong package manager too. `getFFmpegInstallHint()` already exists in browser/ffmpeg.ts (and is already used by render.ts) and handles darwin / linux / win32 correctly. Use it here too. Also rewrite checkFFprobe: - it previously used `which ffprobe` which is not available on Windows (cmd uses `where`), so on Windows the check always reported "Not found" even when ffprobe was on PATH - run `ffprobe -version` directly instead, which works cross-platform whenever ffprobe is resolvable on PATH, and surfaces the version string in the same style as the FFmpeg check
1 parent 03bf1e6 commit 64e3735

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

packages/cli/src/commands/doctor.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const examples: Example[] = [["Check system dependencies", "hyperframes d
66
import { freemem, platform } from "node:os";
77
import { c } from "../ui/colors.js";
88
import { findBrowser } from "../browser/manager.js";
9-
import { findFFmpeg } from "../browser/ffmpeg.js";
9+
import { findFFmpeg, getFFmpegInstallHint } from "../browser/ffmpeg.js";
1010
import { VERSION } from "../version.js";
1111
import { getUpdateMeta } from "../utils/updateCheck.js";
1212
import { getSystemMeta, getShmSizeMb, getFreeDiskMb, bytesToMb } from "../telemetry/system.js";
@@ -36,19 +36,22 @@ function checkFFmpeg(): CheckResult {
3636
return {
3737
ok: false,
3838
detail: "Not found",
39-
hint: process.platform === "darwin" ? "brew install ffmpeg" : "sudo apt install ffmpeg",
39+
hint: getFFmpegInstallHint(),
4040
};
4141
}
4242

4343
function checkFFprobe(): CheckResult {
44+
// `ffprobe -version` works cross-platform if it's on PATH — no need for
45+
// `which`/`where` shell detection, which differs by OS.
4446
try {
45-
const result = execSync("which ffprobe", { encoding: "utf-8", timeout: 5000 }).trim();
46-
return { ok: true, detail: result };
47+
const version =
48+
execSync("ffprobe -version", { encoding: "utf-8", timeout: 5000 }).split("\n")[0] ?? "";
49+
return { ok: true, detail: version.trim() };
4750
} catch {
4851
return {
4952
ok: false,
5053
detail: "Not found",
51-
hint: "Installed with ffmpeg",
54+
hint: `Installed with ffmpeg${getFFmpegInstallHint()}`,
5255
};
5356
}
5457
}

0 commit comments

Comments
 (0)