mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
test(producer): treat an all-literal probe argv as taking no input
CI runs the PR merged with main, so it saw a caller my branch predated:
`spawnSync("ffprobe", ["-version"])` in engine/src/utils/ffprobe.test.ts. That
is a capability check with no runtime path, so there is nothing to terminate,
but the unclassified guard flagged it as a caller it could not parse.
An argv whose entries are all string literals carries no input by
construction. Those are dropped before the check; an argv with a bare
identifier still has to be understood, verified by adding one and watching the
guard fail.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
255cf92915
commit
c81f68b592
@@ -77,7 +77,17 @@ function mentionsProbe(src: string): boolean {
|
|||||||
// Comments and doc prose describing a spawn are not a spawn:
|
// Comments and doc prose describing a spawn are not a spawn:
|
||||||
// `tts.test.mjs` explains `ffprobeDuration's spawnSync("ffprobe", ...) call`
|
// `tts.test.mjs` explains `ffprobeDuration's spawnSync("ffprobe", ...) call`
|
||||||
// in a comment and was reported as an unclassified caller.
|
// in a comment and was reported as an unclassified caller.
|
||||||
const code = src.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
|
// A probe spawned with an all-literal argv takes no runtime input, so
|
||||||
|
// there is nothing to terminate: `spawnSync("ffprobe", ["-version"])` is a
|
||||||
|
// capability check, not a file probe. Dropping those before the test keeps
|
||||||
|
// them out of the unclassified list without weakening it — an argv carrying
|
||||||
|
// a bare identifier (a path) still has to be understood.
|
||||||
|
const NO_INPUT_PROBE =
|
||||||
|
/(?:spawn|spawnSync|execFile\w*|exec)\s*\(\s*["'`]ff(?:probe|mpeg)["'`]\s*,\s*\[\s*(?:"[^"]*"\s*,?\s*)+\]/g;
|
||||||
|
const code = src
|
||||||
|
.replace(/\/\*[\s\S]*?\*\//g, "")
|
||||||
|
.replace(/\/\/[^\n]*/g, "")
|
||||||
|
.replace(NO_INPUT_PROBE, "");
|
||||||
return /(?:spawn|spawnSync|execFile\w*|exec)\s*\(\s*[^,)]*(?:ffprobe|ffProbe|probeBin|probePath)/i.test(
|
return /(?:spawn|spawnSync|execFile\w*|exec)\s*\(\s*[^,)]*(?:ffprobe|ffProbe|probeBin|probePath)/i.test(
|
||||||
code,
|
code,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user