mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Start helper_scripts as childs and not just import them into the main script
This commit is contained in:
parent
57bd3c5a4e
commit
22f0d752ea
@ -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] + ".");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user