Merge pull request #2997 from hardillb/watch-fix

Watch node throws errors if new files deleted
This commit is contained in:
Nick O'Leary
2021-06-08 11:07:37 +01:00
committed by GitHub

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;