diff --git a/lib/server/console.js b/lib/server/console.js index ee951194..231312da 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -130,9 +130,9 @@ ret = true; onCD(command, dir, function(error, json) { - var path = ''; + var path; - if (!error) { + if (json.path) { path = json.path; ClientDirs[connNum] = path; } @@ -291,17 +291,20 @@ } exec(command, {cwd : paramDir}, function (error, stdout, stderr) { - var errorStr = ''; + var path = paramDir, + errorStr = ''; - if (stderr) + if (stderr) { errorStr = stderr; - else if (error) + } else if (error) { errorStr = error.message; + path = ''; + } callback(error || stderr, { stderr : addNewLine(errorStr), stdout : stdout, - path : paramDir + path : path }); }); }