diff --git a/lib/server/socket.js b/lib/server/socket.js index 68f39689..07e3b99b 100644 --- a/lib/server/socket.js +++ b/lib/server/socket.js @@ -215,7 +215,9 @@ if (!Util.isString(lError)) - lErrorStr = lError.toString() + '\n'; + lErrorStr = lError.toString(); + + lErrorStr = Util.addNewLine(lErrorStr); lExec = { stdout : pStdout, diff --git a/lib/util.js b/lib/util.js index e988253c..2f649037 100644 --- a/lib/util.js +++ b/lib/util.js @@ -46,6 +46,20 @@ Util = exports || {}; } }, + /** + * ad new line (if it's not) + * @param {string} pText + */ + Util.addNewLine = function(pText){ + var lNewLine = '', + n = pText && pText.length; + + if(n && pText[n-1] !== '\n') + lNewLine = '\n'; + + return pText + lNewLine; + }; + /** setting function context * @param {function} pFunction * @param {object} pContext