diff --git a/core/core.js b/core/core.js index 73e4c912..6ed66f7f 100644 --- a/core/core.js +++ b/core/core.js @@ -150,6 +150,12 @@ function postMessageInternal(from, to, message) { return invoke(to.eventHandlers['onMessage'], [getUser(from, from), message]); } +function killProcess(process) { + if (process && process.task) { + return process.task.kill(); + } +} + async function getService(service, packageName) { let process = this; let serviceName = process.packageName + '_' + service; @@ -157,6 +163,7 @@ async function getService(service, packageName) { return serviceProcess.ready.then(function() { return { postMessage: postMessageInternal.bind(process, process, serviceProcess), + kill: killProcess.bind(process, serviceProcess), } }); } @@ -228,11 +235,6 @@ async function getManifest(fileName) { return result; } -function packageNameToPath(name) { - var process = this; - return "packages/" + process.packageOwner + "/" + name + "/"; -} - async function getProcess(packageOwner, packageName, key, options) { var process = gProcesses[key]; if (!process @@ -365,17 +367,13 @@ async function getProcess(packageOwner, packageName, key, options) { print("Activating task"); process.task.activate(); print("Executing task"); - process.task.execute({name: fileName, source: readFileUtf8(fileName)}).then(function() { - print("Task ready"); - broadcastEvent('onSessionBegin', [getUser(process, process)]); - resolveReady(process); - if (process.terminal) { - process.terminal.print({action: "ready"}); - } - }).catch(function(error) { - printError(process.terminal, error); - rejectReady(); - }); + await process.task.execute({name: fileName, source: readFileUtf8(fileName)}); + print("Task ready"); + broadcastEvent('onSessionBegin', [getUser(process, process)]); + resolveReady(process); + if (process.terminal) { + process.terminal.print({action: "ready"}); + } } catch (error) { printError(process.terminal, error); rejectReady(); @@ -431,8 +429,6 @@ try { print("Error loading settings from " + kGlobalSettingsFile + ": " + error); } -var kIgnore = ["/favicon.ico"]; - var auth = require("auth"); var httpd = require("httpd"); httpd.all("/login", auth.handler); diff --git a/core/terminal.js b/core/terminal.js index d3924d7c..58e94d1e 100644 --- a/core/terminal.js +++ b/core/terminal.js @@ -43,9 +43,6 @@ Terminal.prototype.dispatch = function(data) { } } -Terminal.prototype.feedWaiting = function(waiting, data) { -} - Terminal.prototype.print = function() { var data = arguments; if (this._selected) {