import { promisify } from 'node:util';
import { execFile } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { c as chunkify } from './ccjk.KfSWcGlE.mjs';

const pExecFile = promisify(execFile);

async function chunkedExec(binary, paths, maxPaths) {
	for (const chunk of chunkify(paths, maxPaths)) {
		// eslint-disable-next-line no-await-in-loop
		await pExecFile(fileURLToPath(binary), chunk);
	}
}

export { chunkedExec as c };
