Permalink
Browse files

system() should parse out just the OS name

  • Loading branch information...
1 parent e0622ed commit 68bae507d2d9c0232b97039e71e16b3d51da30c2 @mscdex committed Dec 17, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −1 README.md
  2. +5 −1 ftp.js
View
@@ -164,7 +164,7 @@ Methods
* **pwd**(< _function_ >callback) - _(void)_ - Retrieves the current working directory. `callback` has 2 parameters: < _Error_ >err, < _string_ >cwd.
-* **system**(< _function_ >callback) - _(void)_ - Retrieves information about the server's operating system. `callback` has 2 parameters: < _Error_ >err, < _string_ >info.
+* **system**(< _function_ >callback) - _(void)_ - Retrieves the server's operating system. `callback` has 2 parameters: < _Error_ >err, < _string_ >OS.
### Extended commands (RFC 3659)
View
6 ftp.js
@@ -428,7 +428,11 @@ FTP.prototype.rmdir = function(path, cb) { // RMD is optional
};
FTP.prototype.system = function(cb) { // SYST is optional
- this._send('SYST', cb);
+ this._send('SYST', function(err, text) {
+ if (err)
+ return cb(err);
+ cb(undefined, /^([^ ]+)(?: |$)/.exec(text)[1]);
+ });
};
// "Extended" (RFC 3659) commands

0 comments on commit 68bae50

Please sign in to comment.