Commit b42d3f57 authored by priit's avatar priit

Arhiivi lahtipakkija vigase väljundi parandus

parent 007a231e
/**
* Created by priit on 1.06.15.
*/
var logger = require('log4js').getLogger('session_model');
var Session = function( id ){
this.isAsync = false;
this.isFinished = false;
......@@ -14,6 +13,7 @@ var Session = function( id ){
this.outputFiles = {};
this.errors = null;
this.pid = null; //system process id
this.log = [];
};
Session.prototype.addOutputFile = function(key, file){
......@@ -26,6 +26,14 @@ Session.prototype.setErrors = function(errors){
this.message = Session.messages.ERROR
};
Session.prototype.addLog = function(log){
if( ! this.log instanceof Array){
logger.error('Session is not array: ', this.log);
}
this.log.push( log );
};
Session.prototype.getRequestFile = function( key ){
var fileValue = this.requestFiles[ key ];
......
......@@ -34,10 +34,12 @@ function LocalExecutor() {
logger.debug('Created process: ', process);
session.pid = process.pid;
session.addLog({command: command, attributes: commandParams});
async.waterfall([
function (callback) {
session.pid = process.pid;
sessionService.saveSession( session, function (err, session) {
callback();
});
......
......@@ -189,6 +189,7 @@ function SessionService() {
response.success = session.success;
response.message = session.message;
response.log = session.log;
if(session.errors != null){
response.errors = session.errors;
......
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