From d6a1fad5274fff768e87cd3be105549694a479ce Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 22 Feb 2014 02:36:56 -0500 Subject: [PATCH] removing timeout before restarting nodebb, fixing nodebb executable --- loader.js | 8 ++++---- nodebb | 33 ++++++++------------------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/loader.js b/loader.js index eb46269d5a..21fb5d0c8c 100644 --- a/loader.js +++ b/loader.js @@ -2,16 +2,16 @@ var fork = require('child_process').fork, start = function() { var nbb = fork('./app', [], { env: { - 'NODE_ENV': 'development' + 'NODE_ENV': process.env.NODE_ENV } }); nbb.on('message', function(cmd) { if (cmd === 'nodebb:restart') { - nbb.kill(); - setTimeout(function() { + nbb.on('exit', function() { start(); - }, 1000); + }); + nbb.kill(); } }); }; diff --git a/nodebb b/nodebb index e514db0051..0ea67b0a69 100755 --- a/nodebb +++ b/nodebb @@ -6,57 +6,40 @@ case "$1" in start) - node app "$@" + node loader "$@" ;; upgrade) npm install ls -d node_modules/nodebb* | xargs -n1 basename | xargs npm install ls -d node_modules/nodebb* | xargs -n1 basename | xargs npm update - node app --upgrade + node loader --upgrade touch package.json echo -e "\n\e[00;32mNodeBB Dependencies up-to-date!\e[00;00m"; ;; setup) - node app --setup + node loader --setup ;; - reset) - node app --reset - ;; + reset) + node loader --reset + ;; dev) 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 node app "$@" + NODE_ENV=development node loader "$@" ;; watch) 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 "$@" ;; - # language) - # case "$2" in - # check) - # node app --language="check" - # ;; - - # *) - # echo "Language Settings" - # echo $"Usage: $0 language {check}" - # echo '' - # column -s ' ' -t <<< ' - # check Compare language files against the /en directory - # ' - # ;; - # esac - # ;; - *) echo "Welcome to NodeBB" echo $"Usage: $0 {start|dev|watch|upgrade}"