fix: emfile error on pnpm store status (#3212)

close #3185
This commit is contained in:
Zoltan Kochan
2021-03-02 15:00:14 +02:00
committed by Zoltan Kochan
parent 198db06d77
commit 5ea3a1e79f
3 changed files with 20 additions and 2 deletions

View File

@@ -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.

View File

@@ -48,7 +48,7 @@ export default async function (maybeOpts: StoreStatusOptions) {
: path.join(storeDir, pkgPath, 'integrity.json')
const { files } = await loadJsonFile<PackageFilesIndex>(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)

View File

@@ -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'])