UNPKG

1.23 kBJavaScriptView Raw
1/*
2
3 This file is a part of node-on-train project.
4
5 Copyright (C) Thanh D. Dang <thanhdd.it@gmail.com>
6
7 node-on-train is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 node-on-train is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22
23var path = require('path');
24var fs = require('fs');
25var spawn = require('child_process').spawn;
26
27module.exports = function () {
28 var path_server_ls = path.dirname(fs.realpathSync(__filename)) + '/server.js';
29 var params = [path_server_ls];
30 for (var i = 3; i < process.argv.length; i++) {
31 params.push(process.argv[i]);
32 }
33 var lsc = spawn('node', params, { stdio: [0,1,2] });
34 lsc.on('exit', function (code) {
35 console.log('Error Code: ' + code);
36 console.log('Exiting');
37 lsc.kill();
38 });
39}