export async function spawnWorkers()

in src/master.ts [40:64]


export async function spawnWorkers(options: IOptions) {
  const pool = new WorkerPool(options);
  const progress = new ProgressReporter(options.quiet, options.check);

  runGlobs(options.files, await getIgnore(options.ignorePath))
    .pipe(
      bufferCount(bufferSize),
      mergeMap((files) => pool.format(files), pool.maxSize * 2),
    )
    .subscribe(
      (result) => progress.update(result),
      (err) => {
        throw err;
      },
      () => {
        progress.complete();

        if ((progress.reformatted && options.check) || progress.failed) {
          process.exit(1);
        } else {
          process.exit(0);
        }
      },
    );
}