Commit db6394b8 authored by Efthymia Bika's avatar Efthymia Bika

Kill running processes on exit

parent ba9ed922
......@@ -25,10 +25,13 @@ var BAAS_HOME_DIR = '.baas';
var CLOUDS_CONF_FILE = 'clouds.rc';
var BACKUP_CONF_FILE = 'backups.rc';
var TEMPLATES_FILE = 'templates.rc';
var BAAS_LOG_DIR = path.join(get_user_home(), BAAS_HOME_DIR, 'log');
var BAAS_CACHE_DIR = path.join(get_user_home(), BAAS_HOME_DIR, 'cache');
var RESTORE_DEFAULT_DIR = path.join(get_user_home(), "Downloads");
var running_processes = [];
var exec_path = path.dirname(process.execPath);
if(process.platform == 'darwin') {
exec_path = path.join(
......@@ -188,3 +191,17 @@ function getClient(name, URL, token, CAPath) {
if (clients[name].getCA() !== CAPath) clients[name].setCA(CAPath);
return clients[name];
}
function kill_callback(error, stdout, stderr) {
if(error) {
console.error(stderr);
}
console.log(stdout);
}
function kill_processes() {
for(var i = 0; i < running_processes.length; i++) {
console.log(running_processes[i]);
running_processes[i].kill();
}
}
......@@ -178,6 +178,7 @@ function call_duplicity(mode, backup_set, force) {
build_extra_args(backup_set.include, "include", args);
build_extra_args(backup_set.exclude, "exclude", args);
args.push("-v8");
$('html,body').animate({
scrollTop: $("#msg_div").offset().top}, 1000);
break;
......@@ -245,6 +246,7 @@ function call_duplicity(mode, backup_set, force) {
} else {
wProcess = spawn(DUPLICITY_PATH, args);
}
running_processes.push(wProcess);
var output_str = "";
function dup_call_out(data) {
......@@ -285,6 +287,7 @@ function call_duplicity(mode, backup_set, force) {
function dup_call_exit(code) {
console.log("exit code === " + code);
running_processes.pop(wProcess);
$("#loader").hide();
if(mode == "backup") {
disable_actions(false);
......
......@@ -46,6 +46,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
win.resizeTo(900, 750);
win.focus();
win.on('close', function() {
this.hide(); // Pretend to be closed already
kill_processes();
this.close(true);
});
$(document).ready(function() {
$("#activity-link").trigger("click").addClass("active");
});
......
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