mirror of
https://github.com/SrIzan10/nodemon.git
synced 2026-05-01 10:55:09 +00:00
prevent unnecessary looping
This commit is contained in:
13
nodemon
13
nodemon
@@ -41,17 +41,20 @@ function startMonitor() {
|
||||
var cmd = 'find . -newer ' + flag + ' -print;';
|
||||
|
||||
exec(cmd, function (error, stdout, stderr) {
|
||||
var files = stdout.split(/\n/), finalFiles;
|
||||
var files = stdout.split(/\n/);
|
||||
|
||||
files.pop(); // remove blank line ending and split
|
||||
if (files.length) {
|
||||
finalFiles = files.filter(function(file) {
|
||||
return !reIgnoreFiles.test(file);
|
||||
});
|
||||
// filter ignored files
|
||||
if (ignoreFiles.length) {
|
||||
files = files.filter(function(file) {
|
||||
return !reIgnoreFiles.test(file);
|
||||
});
|
||||
}
|
||||
|
||||
fs.writeFileSync(flag, '');
|
||||
|
||||
if (finalFiles.length) {
|
||||
if (files.length) {
|
||||
sys.log('[nodemon] restarting due to changes...');
|
||||
finalFiles.forEach(function (file) {
|
||||
sys.log('[nodemon] ' + file);
|
||||
|
||||
Reference in New Issue
Block a user