diff --git a/lib/lib.js b/lib/lib.js index d88a2b12..00c2dddf 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -355,8 +355,9 @@ var setup_unionfs_chroot = function (chroot_base, git_home, rw_folder, final_chr exports.node_versions = node_versions; var watcher_code = function(user,pass){ - return "(new (require('node-watcher'))({host:'http://nodester.com',user:'"+user + "',password:'"+ pass+"',path:'/app/audit'})).emitter({maxMemory:25,sizeSpace:25,checkSpace:true})" + return ";(new (require('node-watcher'))({host:'http://nodester.com',user:'"+user + "',password:'"+ pass+"',path:'/app/audit'})).emitter({maxMemory:25,sizeSpace:25,checkSpace:true});" } + exports.watcher_code = watcher_code; var insert_code = function(location,file,code, cb){ @@ -369,8 +370,12 @@ var insert_code = function(location,file,code, cb){ if (!err){ var old = fs.readFileSync(target, 'utf8'); var newfile =''; + var oldcode = code.split(''); + oldcode[0]==';'?oldcode[0]='';oldcode[0] + oldcode[oldcode.length-1]==';'?oldcode[oldcode.length-1]='';oldcode[oldcode.length-1] + oldcode = olcode.join(''); old = old.split('\n').filter(function(line){ - return line !== code; + return line !== code && line !== oldcode; }).join('\n'); var lines = old.split('\n'); if (/\#!\//gi.test(lines[0])){