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

Function spawn

packages/engine/src/utils/ffprobe.test.ts:134–163  ·  view source on GitHub ↗
(command: string, args: readonly string[])

Source from the content-addressed store, hash-verified

132 const calls: SpawnCall[] = [];
133 let invocation = 0;
134 const spawn = (command: string, args: readonly string[]): FakeProc => {
135 calls.push({ command, args });
136 const outcome = outcomes[invocation] ?? outcomes[outcomes.length - 1];
137 invocation += 1;
138
139 const proc = new EventEmitter() as FakeProc;
140 proc.stdout = new EventEmitter();
141 proc.stderr = new EventEmitter();
142
143 process.nextTick(() => {
144 if (!outcome) return;
145 if (outcome.kind === "missing") {
146 const err = new Error("spawn ffprobe ENOENT") as NodeJS.ErrnoException;
147 err.code = "ENOENT";
148 proc.emit("error", err);
149 return;
150 }
151 if (outcome.kind === "error") {
152 const err = new Error(outcome.message) as NodeJS.ErrnoException;
153 if (outcome.code) err.code = outcome.code;
154 proc.emit("error", err);
155 return;
156 }
157 if (outcome.stdout) proc.stdout.emit("data", Buffer.from(outcome.stdout));
158 if (outcome.stderr) proc.stderr.emit("data", Buffer.from(outcome.stderr));
159 proc.emit("close", outcome.code);
160 });
161
162 return proc;
163 };
164 return { spawn, calls };
165}
166

Callers 15

runFfprobeFunction · 0.70
runFfmpegFunction · 0.70
detectGpuEncoderFunction · 0.70
canUseGpuEncoderFunction · 0.70
runAnimatedGifTranscodeFunction · 0.50
runFFmpegFunction · 0.50
runFfmpegWithStdinFunction · 0.50
runFfprobeJsonFunction · 0.50
decodeAudioPeaksFunction · 0.50
openBrowserFunction · 0.50
launchDetachedInstallFunction · 0.50

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected