fast-glob
fast-glob copied to clipboard
EACCES exception raised for directories without read permissions
Environment
- OS Version: Linux x64 5.4.0-90-generic
- Node.js Version: v14.18.1
Actual behavior
fast-glob throws a EACCES
or hangs (i.e. fails silently) depending on if suppressErrors
is set for directory with inadequate read permissions.
Expected behavior
Ignore directory and continue glob search, or have an option to ignore EACCES errors.
Steps to reproduce
- Create a some directories
mkdir -p temp/{public,private}
- Revoke read permissions to one
chmod -r temp/private
- Run code snippet
Code sample
I encountered this in TypeScript but it's the same code.
import * as fg from 'fast-glob';
const globIncPaths: string[] = fg.sync('temp/**', {
cwd: 'your/cwd',
onlyDirectories: true,
suppressErrors: false, // set to true to trigger a race condition
});
Additional information
I have found a fix using glob
and setting the option { strict: false }
. Is there something equivalent for fast-glob
?