From 6680d4495cf924dfc001afd6979e042f544f9f4e Mon Sep 17 00:00:00 2001 From: NAmorim Date: Thu, 21 Oct 2021 11:54:45 +0100 Subject: [PATCH] Notify electron that server is running --- PlatformRoot.js | 4 ++++ electron-wrapper.js | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PlatformRoot.js b/PlatformRoot.js index 2539bdb15..d1cdab872 100644 --- a/PlatformRoot.js +++ b/PlatformRoot.js @@ -15,6 +15,7 @@ The SA object is accesible everywhere at the Superalgos Desktop App. It provides access to all modules built for Superalgos in general. */ global.SA = {} + /* Load Environment Variables */ let ENVIRONMENT = require('./Environment.js'); let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() @@ -84,4 +85,7 @@ async function run(initialWorkspace) { PL.app = require('./Platform/PlatformApp.js').newPlatformApp() await PL.app.run(initialWorkspace) console.log('Superalgos Platform App is Running!') + if(process.send) { + process.send("Running") + } } diff --git a/electron-wrapper.js b/electron-wrapper.js index 73aa9fe08..6b0e73f8a 100644 --- a/electron-wrapper.js +++ b/electron-wrapper.js @@ -27,10 +27,12 @@ function run() { } const { fork } = require('child_process') - fork(path.join(__dirname, '/PlatformRoot.js'), ["noBrowser"]) - - server_ready = true - if (app_ready) open() + const platform = fork(path.join(__dirname, '/PlatformRoot.js'), ["noBrowser"], {stdio: ['pipe', 'pipe', 'pipe', 'ipc']}) + platform.on('message', message => { + if(message == "Running") { + open() + } + }) } function open () {