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) {
return;
}
files.forEach( function(f) {
complete_path = path.join(dir, f);
if (onlyDirectories) {
if (fs.statSync(complete_path).isDirectory()) {
result.push(f);
try {
complete_path = path.join(dir, f);
if (onlyDirectories) {
if (fs.statSync(complete_path).isDirectory()) {
result.push(f);
}
}
}
else {
if (fs.statSync(complete_path).isFile()) {
result.push(f);
else {
if (fs.statSync(complete_path).isFile()) {
result.push(f);
}
}
}
} catch (fs_error) {}
});
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