From 7b46d66e681f79f99b23dd92985864268a2baca2 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 26 Feb 2014 13:42:39 -0500 Subject: [PATCH] having the loader play nicely with supervisor -- ./nodebb watch can now hit the restart button --- loader.js | 11 +++++++++-- nodebb | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) 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 "$@" ;; *)