Register cleanup handler to kill an ffmpeg process when the Node.js process exits. Returns an unregister function — call it once the ffmpeg process finishes normally.
Listens to process exit, SIGINT, SIGTERM, and beforeunload (for Deno compat).
const proc = ffmpeg('input.mp4').output('out.mp4').spawn();const unregister = autoKillOnExit(proc.child);proc.emitter.on('end', () => unregister()); Copy
const proc = ffmpeg('input.mp4').output('out.mp4').spawn();const unregister = autoKillOnExit(proc.child);proc.emitter.on('end', () => unregister());
Register cleanup handler to kill an ffmpeg process when the Node.js process exits. Returns an unregister function — call it once the ffmpeg process finishes normally.
Listens to process exit, SIGINT, SIGTERM, and beforeunload (for Deno compat).