Skip to content

Node.js based forum software built for the modern web

having the loader play nicely with supervisor -- ./nodebb watch can now hit the restart button

Julian Lam7b46d66e681f
diff --git a/loader.js b/loader.js
index 63027b1603..2263955ef9 100644
--- a/loader.js
+++ b/loader.js
@@ -1,6 +1,6 @@
var fork = require('child_process').fork,
start = function() {
- var nbb = fork('./app', process.argv.slice(2), {
+ nbb = fork('./app', process.argv.slice(2), {
env: {
'NODE_ENV': process.env.NODE_ENV
}
@@ -14,6 +14,13 @@ var fork = require('child_process').fork,
nbb.kill();
}
});
- }
+ },
+ stop = function() {
+ nbb.kill();
+ },
+ nbb;
+
+process.on('SIGINT', stop);
+process.on('SIGTERM', stop);
start();
\ No newline at end of file
diff --git a/nodebb b/nodebb
index cdefacd524..0ea67b0a69 100755
--- a/nodebb
+++ b/nodebb
@@ -37,7 +37,7 @@ case "$1" in
echo "Launching NodeBB in \"development\" mode."
echo "To run the production build of NodeBB, please use \"forever\"."
echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB"
- NODE_ENV=development supervisor -q --extensions 'node|js|tpl' -- app "$@"
+ NODE_ENV=development supervisor -q --extensions 'node|js|tpl' -- loader "$@"
;;
*)