From bfdd045c94b4bb5d25f32fbcdc23795f8068be51 Mon Sep 17 00:00:00 2001 From: remy Date: Sun, 3 Oct 2010 17:04:27 +0100 Subject: [PATCH] Updated to dynamic reload the ignore list if the ignore file changes --- nodemon | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nodemon b/nodemon index 9ddbc88..a3240ed 100755 --- a/nodemon +++ b/nodemon @@ -76,15 +76,23 @@ function startMonitor() { }); } -require('path').exists(ignoreFilePath, function () { +function readIgnoreFile() { + sys.log('[nodemon] reading ignore list'); var lines = fs.readFileSync(ignoreFilePath).toString().split(/\n/); + ignoreFiles = [flag]; lines.forEach(function (line) { // remove comments and trim lines line = line.replace(/#.*$/, '').replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g, ''); if (line) { ignoreFiles.push(line); } - }); + }); +} + +require('path').exists(ignoreFilePath, function () { + readIgnoreFile(); + // monitor the ignore file for any changes and reload the script if it does change + fs.watchFile(ignoreFilePath, { persistent: false }, readIgnoreFile); }); // touch