MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / findOnPath

Function findOnPath

packages/cli/src/browser/ffmpeg.ts:10–26  ·  view source on GitHub ↗
(name: "ffmpeg" | "ffprobe")

Source from the content-addressed store, hash-verified

8export const FFPROBE_PATH_ENV = "HYPERFRAMES_FFPROBE_PATH";
9
10function findOnPath(name: "ffmpeg" | "ffprobe"): string | undefined {
11 try {
12 const cmd = process.platform === "win32" ? `where ${name}` : `which ${name}`;
13 const output = execSync(cmd, {
14 encoding: "utf-8",
15 stdio: ["pipe", "pipe", "pipe"],
16 timeout: 5000,
17 });
18 const first = output
19 .split(/\r?\n/)
20 .map((s) => s.trim())
21 .find(Boolean);
22 return first ? resolve(first) : undefined;
23 } catch {
24 return undefined;
25 }
26}
27
28// GUI/Dock/launchd-spawned processes on macOS don't inherit the shell PATH, so
29// `which ffmpeg` fails even when ffmpeg is installed via Homebrew. Probe the

Callers 1

findConfiguredBinaryFunction · 0.70

Calls 2

resolveFunction · 0.85
findMethod · 0.65

Tested by

no test coverage detected