Merge pull request #107 from paviro/v2-beta

Start helper_scripts as childs
This commit is contained in:
Michael Teeuw 2016-03-28 13:25:46 +02:00
commit 1e30811112

View File

@ -2,6 +2,7 @@
//for searching modules //for searching modules
const walk = require('walk'); const walk = require('walk');
const spawn = require('child_process').spawn;
const electron = require('electron'); const electron = require('electron');
// Module to control application life. // Module to control application life.
@ -39,7 +40,8 @@ var module_loader = walk.walk(__dirname + '/../modules', { followLinks: false }
module_loader.on('file', function(root, stat, next) { module_loader.on('file', function(root, stat, next) {
//if file is called node_helper.js load it //if file is called node_helper.js load it
if (stat.name == "node_helper.js"){ if (stat.name == "node_helper.js"){
require(root + '/' + stat.name); //start module as child
spawn('node', [root + '/' + stat.name])
//Log module name //Log module name
var module = (root + '/' + stat.name).split("/") var module = (root + '/' + stat.name).split("/")
console.log("Started helper script for module " + module[module.length-2] + "."); console.log("Started helper script for module " + module[module.length-2] + ".");