diff --git a/lib/server/console.js b/lib/server/console.js index bee78293..7bc3af5b 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -175,10 +175,12 @@ */ function setExec(callback, error, stdout, stderr) { var json, - errorStr = stderr || error; - - if (errorStr) - errorStr = addNewLine(errorStr + ''); + errorStr = ''; + + if (stderr) + errorStr = stderr; + else if (error) + errorStr = error.message; json = { stdout : stdout, @@ -283,16 +285,14 @@ command = 'cd ' + path.join(currDir, paramDir); exec(command + ' && ' + getDir, {cwd : currDir}, function (error, stdout, stderr) { - var errorStr = '', - errorData = stderr || error, - isStr = Util.isString(errorData); + var errorStr = ''; - if (errorData && !isStr) - errorStr = Util.stringifyJSON(errorData); - else - errorStr = errorData; + if (stderr) + errorStr = stderr; + else if (error) + errorStr = error.message; - callback(errorData, { + callback(error || stderr, { stderr : errorStr, path : CloudFunc.rmNewLine(stdout) });