Skip to content

Node.js based forum software built for the modern web

cleanup / lint before diving in

psychobunny3cc5e1473fc7
diff --git a/src/meta/js.js b/src/meta/js.js
index bd3b18dbe6..b0e4a7afad 100644
--- a/src/meta/js.js
+++ b/src/meta/js.js
@@ -125,22 +125,7 @@ module.exports = function(Meta) {
Meta.js.minify = function(callback) {
if (nconf.get('isPrimary') === 'true') {
- /**
- * Check if the parent process is running with the debug option --debug (or --debug-brk)
- */
- var forkProcessParams = {};
- if(global.v8debug || process.execArgv.indexOf('--debug') != -1) {
- /**
- * use the line below if you want to debug minifier.js script too (or even --debug-brk option, but
- * you'll have to setup your debugger and connect to the forked process)
- */
- //forkProcessParams = {execArgv: ['--debug=' + (global.process.debugPort + 1), '--nolazy']};
-
- /**
- * otherwise, just clean up --debug/--debug-brk options which are set up by default from the parent one
- */
- forkProcessParams = {execArgv: []};
- }
+ var forkProcessParams = setupDebugging();
var minifier = Meta.js.minifierProc = fork('minifier.js', [], forkProcessParams),
onComplete = function(err) {
@@ -200,7 +185,7 @@ module.exports = function(Meta) {
}
};
- Meta.js.killMinifier = function(callback) {
+ Meta.js.killMinifier = function() {
if (Meta.js.minifierProc) {
Meta.js.minifierProc.kill('SIGTERM');
}
@@ -268,8 +253,7 @@ module.exports = function(Meta) {
}).filter(function(a) { return a; });
if (matches.length) {
- var relPath = jsPath.slice(('plugins/' + matches[0]).length),
- pluginId = matches[0].split(path.sep)[0];
+ var relPath = jsPath.slice(('plugins/' + matches[0]).length);
return plugins.staticDirs[matches[0]] + relPath;
} else {
@@ -282,4 +266,25 @@ module.exports = function(Meta) {
callback();
});
}
+
+ function setupDebugging() {
+ /**
+ * Check if the parent process is running with the debug option --debug (or --debug-brk)
+ */
+ var forkProcessParams = {};
+ if(global.v8debug || parseInt(process.execArgv.indexOf('--debug'), 10) !== -1) {
+ /**
+ * use the line below if you want to debug minifier.js script too (or even --debug-brk option, but
+ * you'll have to setup your debugger and connect to the forked process)
+ */
+ //forkProcessParams = {execArgv: ['--debug=' + (global.process.debugPort + 1), '--nolazy']};
+
+ /**
+ * otherwise, just clean up --debug/--debug-brk options which are set up by default from the parent one
+ */
+ forkProcessParams = {execArgv: []};
+ }
+
+ return forkProcessParams;
+ }
};