1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Watch node throws errors if new files deleted

before the node has finished processing them all.

Fixes #2996
This commit is contained in:
Ben Hardill 2021-05-28 08:34:08 +01:00
parent 0fb7d3bfc8
commit 7585f14b89
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7

View File

@ -23,9 +23,13 @@ module.exports = function(RED) {
var getAllDirs = function (dir, filelist) {
filelist = filelist || [];
fs.readdirSync(dir).forEach(file => {
if (fs.statSync(path.join(dir, file)).isDirectory() ) {
filelist.push(path.join(dir, file));
getAllDirs(path.join(dir, file), filelist);
try {
if (fs.statSync(path.join(dir, file)).isDirectory() ) {
filelist.push(path.join(dir, file));
getAllDirs(path.join(dir, file), filelist);
}
} catch (error) {
//should we raise an error?
}
});
return filelist;