diff --git a/lib/server/console.js b/lib/server/console.js index 4f982234..e0343a64 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -115,11 +115,15 @@ else if (equalPart(command, 'cd ')) { ret = true; - onCD(command, dir, function(json) { - var path = json.path; + onCD(command, dir, function(error, json) { + var path = ''; + + if (!error) { + path = json.path; + ClientDirs[connNum] = path; + } callback(json); - ClientDirs[connNum] = path; }); } @@ -275,7 +279,7 @@ if (errorData) errorStr = Util.stringifyJSON(errorData); - Util.exec(callback, { + callback(errorData, { stderr : errorStr, path : CloudFunc.rmNewLine(stdout) });