diff --git a/.changeset/wise-lemons-rule.md b/.changeset/wise-lemons-rule.md new file mode 100644 index 0000000000..58b87a18ab --- /dev/null +++ b/.changeset/wise-lemons-rule.md @@ -0,0 +1,6 @@ +--- +"@pnpm/plugin-commands-store": patch +--- + +Avoid the "too many open files error" on `pnpm store status` command. +Limit the concurrency of verifying dependency contents. diff --git a/packages/plugin-commands-store/src/storeStatus/index.ts b/packages/plugin-commands-store/src/storeStatus/index.ts index 7e90e9b9b4..12259a4ca1 100644 --- a/packages/plugin-commands-store/src/storeStatus/index.ts +++ b/packages/plugin-commands-store/src/storeStatus/index.ts @@ -48,7 +48,7 @@ export default async function (maybeOpts: StoreStatusOptions) { : path.join(storeDir, pkgPath, 'integrity.json') const { files } = await loadJsonFile(pkgIndexFilePath) return (await dint.check(path.join(virtualStoreDir, dp.depPathToFilename(depPath, opts.dir), 'node_modules', name), files)) === false - }) + }, { concurrency: 8 }) if (reporter && typeof reporter === 'function') { streamParser.removeListener('data', reporter) diff --git a/packages/plugin-commands-store/test/storeStatus.ts b/packages/plugin-commands-store/test/storeStatus.ts index 5399dae5b9..566862188a 100644 --- a/packages/plugin-commands-store/test/storeStatus.ts +++ b/packages/plugin-commands-store/test/storeStatus.ts @@ -40,7 +40,19 @@ test('CLI does not fail when store status does not find modified packages', asyn prepare() const storeDir = tempy.directory() - await execa('node', [pnpmBin, 'add', 'is-positive@3.1.0', '--store-dir', storeDir, '--registry', REGISTRY, '--verify-store-integrity']) + await execa('node', [ + pnpmBin, + `--store-dir=${storeDir}`, + `--registry=${REGISTRY}`, + '--verify-store-integrity', + 'add', + 'eslint@3.4.0', + 'gulp@4.0.2', + 'highcharts@5.0.10', + 'is-positive@3.1.0', + 'react@15.4.1', + 'webpack@5.24.2', + ]) // store status does not fail on not installed optional dependencies await execa('node', [pnpmBin, 'add', 'not-compatible-with-any-os', '--save-optional', '--store-dir', storeDir, '--registry', REGISTRY, '--verify-store-integrity'])