Commit 0e689cb9 authored by Leo Iannacone's avatar Leo Iannacone

fix if file is removed while forEach is working

parent bf0cd739
...@@ -12,6 +12,7 @@ function __get_files_list(dir, onlyDirectories, callback) { ...@@ -12,6 +12,7 @@ function __get_files_list(dir, onlyDirectories, callback) {
return; return;
} }
files.forEach( function(f) { files.forEach( function(f) {
try {
complete_path = path.join(dir, f); complete_path = path.join(dir, f);
if (onlyDirectories) { if (onlyDirectories) {
if (fs.statSync(complete_path).isDirectory()) { if (fs.statSync(complete_path).isDirectory()) {
...@@ -23,6 +24,7 @@ function __get_files_list(dir, onlyDirectories, callback) { ...@@ -23,6 +24,7 @@ function __get_files_list(dir, onlyDirectories, callback) {
result.push(f); result.push(f);
} }
} }
} catch (fs_error) {}
}); });
callback(result); callback(result);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment