You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodebb/loader.js

26 lines
442 B
JavaScript

var fork = require('child_process').fork,
start = function() {
nbb = fork('./app', process.argv.slice(2), {
env: {
'NODE_ENV': process.env.NODE_ENV
}
});
nbb.on('message', function(cmd) {
if (cmd === 'nodebb:restart') {
nbb.on('exit', function() {
start();
});
nbb.kill();
}
});
},
stop = function() {
nbb.kill();
},
nbb;
process.on('SIGINT', stop);
process.on('SIGTERM', stop);
start();