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

fix if file is removed while forEach is working

parent bf0cd739
...@@ -12,17 +12,19 @@ function __get_files_list(dir, onlyDirectories, callback) { ...@@ -12,17 +12,19 @@ function __get_files_list(dir, onlyDirectories, callback) {
return; return;
} }
files.forEach( function(f) { files.forEach( function(f) {
complete_path = path.join(dir, f); try {
if (onlyDirectories) { complete_path = path.join(dir, f);
if (fs.statSync(complete_path).isDirectory()) { if (onlyDirectories) {
result.push(f); if (fs.statSync(complete_path).isDirectory()) {
result.push(f);
}
} }
} else {
else { if (fs.statSync(complete_path).isFile()) {
if (fs.statSync(complete_path).isFile()) { 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