Commit d5daefab authored by carlosperate's avatar carlosperate

Electron: set kill signal SIGTERM to allow for server exit cleanup.

Originally set to SIGKILL. In versions of the server executable from pyinstaller it creates a child subprocess that was not killed, so SIGTERM allows for clean up on all platforms.
parent f2057616
...@@ -62,10 +62,10 @@ app.on('ready', function () { ...@@ -62,10 +62,10 @@ app.on('ready', function () {
mainWindow.webContents.on('did-fail-load', mainWindow.webContents.on('did-fail-load',
function (event, errorCode, errorDescription) { function (event, errorCode, errorDescription) {
console.log('Page failed to load (' + errorCode + '). The server ' + console.log('Page failed to load (' + errorCode + '). The server ' +
'is probably not yet running. Trying again in 100ms.'); 'is probably not yet running. Trying again in 200 ms.');
setTimeout(function() { setTimeout(function() {
mainWindow.webContents.reload(); mainWindow.webContents.reload();
}, 100); }, 200);
} }
); );
......
...@@ -28,7 +28,7 @@ function getServerExecLocation() { ...@@ -28,7 +28,7 @@ function getServerExecLocation() {
var ardublocklyRootDir = jetpack.dir('../../'); var ardublocklyRootDir = jetpack.dir('../../');
} else { } else {
// Cannot use relative paths with Production, so let's try to find the // Cannot use relative paths with Production, so let's try to find the
// ardublockly folder a a node from the executable file path tree // ardublockly folder in a node from the executable file path tree
var ardublocklyRootDir = jetpack.dir(__dirname); var ardublocklyRootDir = jetpack.dir(__dirname);
var oldArdublocklyRootDir = ''; var oldArdublocklyRootDir = '';
while (ardublocklyRootDir.path() != oldArdublocklyRootDir) { while (ardublocklyRootDir.path() != oldArdublocklyRootDir) {
...@@ -67,7 +67,7 @@ function getServerExecLocation() { ...@@ -67,7 +67,7 @@ function getServerExecLocation() {
var executableLocation = arduexecDir.path(arduexecFileName); var executableLocation = arduexecDir.path(arduexecFileName);
console.log(tag + 'Server executable: ' + executableLocation); console.log(tag + 'Server executable: ' + executableLocation);
return executableLocation; return executableLocation;
} };
function ardublocklyNotFound(working_dir) { function ardublocklyNotFound(working_dir) {
dialog.showMessageBox({ dialog.showMessageBox({
...@@ -109,8 +109,8 @@ module.exports.startServer = function() { ...@@ -109,8 +109,8 @@ module.exports.startServer = function() {
module.exports.stopServer = function() { module.exports.stopServer = function() {
if (serverProcess !== null) { if (serverProcess !== null) {
// Server does not do any exit clean up, so safe to send SIGKILL // Server executable needs to clean up (kill child), so no SIGKILL
serverProcess.kill('SIGKILL'); serverProcess.kill('SIGTERM');
serverProcess = null; serverProcess = null;
} }
}; };
......
...@@ -21,5 +21,12 @@ ...@@ -21,5 +21,12 @@
"build": "./node_modules/.bin/gulp build", "build": "./node_modules/.bin/gulp build",
"release": "./node_modules/.bin/gulp release --env=production", "release": "./node_modules/.bin/gulp release --env=production",
"start": "node ./tasks/start" "start": "node ./tasks/start"
},
"repository" : {
"type" : "git",
"url" : "https://github.com/carlosperate/ardublockly.git"
},
"bugs" : {
"url" : "https://github.com/carlosperate/ardublockly/issues"
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment