-
Notifications
You must be signed in to change notification settings - Fork 744
find() raises error when unable to find any files matching, expected to return empty array. #653
Copy link
Copy link
Closed
Labels
fixBug/defect, or a fix for such a problemBug/defect, or a fix for such a problemhelp wantedlow priority
Description
Node version (or tell us if you're using electron or some other framework):
node v7.4.0 and v5.9.0
ShellJS version (the most recent version/Github branch you see the bug on):
^0.7.6
Operating system:
MAC OS X 10.12.2 (16C67)
Description of the bug:
Raise and error ENOENT when shelljs can't find a directory or file matching the criteria.
Expected result to be an empty array instead.
Propose solution, wrap it in a try/catch block. Not sure able the implications here.
http://stackoverflow.com/a/33401005
Example ShellJS command to reproduce the error:
shell.find(`${overrideDirectory}**/*.json`);
ShellJS: internal error
Error: ENOENT: no such file or directory, stat 'overrides/dev/amp/**/*.json'
at Object.fs.statSync (fs.js:907:18)
at /Users/christ11/Workspace/v-configs/node_modules/shelljs/src/find.js:45:12
at Array.forEach (native)
at Object._find (/Users/christ11/Workspace/v-configs/node_modules/shelljs/src/find.js:42:9)
at Object.find (/Users/christ11/Workspace/v-configs/node_modules/shelljs/src/common.js:365:25)
at Object.exports.mergeOverrides (/Users/christ11/Workspace/v-configs/script/util.js:42:11)
at portals.forEach.portal (/Users/christ11/Workspace/v-configs/script/build.js:27:14)
at Array.forEach (native)
at environments.forEach.env (/Users/christ11/Workspace/v-configs/script/build.js:20:13)
at Array.forEach (native)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixBug/defect, or a fix for such a problemBug/defect, or a fix for such a problemhelp wantedlow priority