#1095·shelljs

Find command crashes when trying to scan Directories without Permission on Windows

Author: DanielTerletzkiyCreated Jun 14, 2022Updated Nov 14, 2023
LabelsfixWindowsgood first issue

Node version (or tell us if you're using electron or some other framework):

v14.17.1

ShellJS version (the most recent version/Github branch you see the bug on):

0.8.5

Operating system:

Windows 10

Description of the bug:

When using the find command, it will throw Error [ShellJSInternalError]: EPERM: operation not permitted, scandir [dir] when it has no permission to access the folder for scanning. Is there a way to let it ignore this directory and continue scanning?

Example ShellJS command to reproduce the error:

javascript
const files = shell.find('.').filter(function (file: string) {
    if (!file.includes('node_modules')) {
        return file.match(/\.git$/);
    }
});