Merge pull request #1482 from Unitech/fix-watch-issues

Fix some watch issues
This commit is contained in:
Joni Shkurti 2015-07-29 16:57:49 +02:00
commit cf229ec1be
3 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@
"script" : "child.js",
"cwd" : "examples",
"node_args" : "--harmony",
"ignoreWatch" : ["[\\/\\\\]\\./", "log"],
"ignore_watch" : ["[\\/\\\\]\\./", "log"],
"watch" : true
}]
}

View File

@ -25,12 +25,14 @@ module.exports = function ClusterMode(God) {
//setup the combined RegEx
var ignored = '';
if (pm2_env.ignore_watch) {
if (util.isArray(pm2_env.ignore_watch) && pm2_env.ignore_watch.length) {
var combined = pm2_env.ignore_watch.reduce(function(previous, current) {
return previous + '|' + current;
});
ignored = new RegExp(combined);
} else if (typeof pm2_env.ignore_watch == 'string') {
ignored = new RegExp(pm2_env.ignorew_watch)
} else {
ignored = /[\/\\]\.|node_modules/;
}

View File

@ -14,7 +14,7 @@ describe('JSON validation tests', function() {
"script" : "chidld.js",
"cwd" : "examadsples",
"node_args" : "--harmoasdny",
"ignoreWatch" : ["[\\/\\\\]\\./", "log"],
"ignore_watch" : ["[\\/\\\\]\\./", "log"],
"watch" : "true"
});
@ -42,7 +42,7 @@ describe('JSON validation tests', function() {
"cwd" : "examples",
"node_args" : "--harmony",
"max_memory_restart" : "10M",
"ignoreWatch" : ["[\\/\\\\]\\./", "log"],
"ignore_watch" : ["[\\/\\\\]\\./", "log"],
"watch" : true,
"node_args" : ["hey","hay"],
"env" : {}