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 () {
mainWindow.webContents.on('did-fail-load',
function (event, errorCode, errorDescription) {
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() {
mainWindow.webContents.reload();
}, 100);
}, 200);
}
);
......
......@@ -28,7 +28,7 @@ function getServerExecLocation() {
var ardublocklyRootDir = jetpack.dir('../../');
} else {
// 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 oldArdublocklyRootDir = '';
while (ardublocklyRootDir.path() != oldArdublocklyRootDir) {
......@@ -67,7 +67,7 @@ function getServerExecLocation() {
var executableLocation = arduexecDir.path(arduexecFileName);
console.log(tag + 'Server executable: ' + executableLocation);
return executableLocation;
}
};
function ardublocklyNotFound(working_dir) {
dialog.showMessageBox({
......@@ -109,8 +109,8 @@ module.exports.startServer = function() {
module.exports.stopServer = function() {
if (serverProcess !== null) {
// Server does not do any exit clean up, so safe to send SIGKILL
serverProcess.kill('SIGKILL');
// Server executable needs to clean up (kill child), so no SIGKILL
serverProcess.kill('SIGTERM');
serverProcess = null;
}
};
......
......@@ -21,5 +21,12 @@
"build": "./node_modules/.bin/gulp build",
"release": "./node_modules/.bin/gulp release --env=production",
"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