simple-ssh
Advanced tools
Comparing version 0.7.4 to 0.8.0
@@ -68,2 +68,11 @@ 'use strict'; | ||
stream.stderr.on('data', function(data) { | ||
data = data.toString(); | ||
stderr += data; | ||
command.handlers.err = command.handlers.err || function() { | ||
console.log(data); | ||
}; | ||
command.handlers.err(data); | ||
}); | ||
stream.on('data', function(data, extended) { | ||
@@ -79,14 +88,4 @@ // This will allow us to send in the password if we're doing something like `sudo` | ||
data = data.toString(); | ||
if (extended === 'stderr') { | ||
stderr += data; | ||
command.handlers.err = command.handlers.err || function() { | ||
console.log(data); | ||
}; | ||
command.handlers.err(data); | ||
} else { | ||
stdout += data; | ||
command.handlers.out(data); | ||
} | ||
stdout += data; | ||
command.handlers.out(data); | ||
} | ||
@@ -194,3 +193,3 @@ }); | ||
}); | ||
}else if (self.pass && self.key) { | ||
} else if (self.pass && self.key) { | ||
self._c.connect({ | ||
@@ -211,3 +210,3 @@ host: self.host, | ||
cb = cb || function(){}; | ||
if (this._c._sock !== undefined) { | ||
if (this._c._sock !== undefined && this._c._state !== 'closed') { | ||
var self = this; | ||
@@ -253,2 +252,13 @@ this._c.on('close', function(err) { | ||
/** | ||
* Removes an event handler from ssh2 | ||
* @param {String} event | ||
* @param {Function} callback | ||
* @return {SSH} | ||
*/ | ||
SSH.prototype.off = function(event, callback) { | ||
this._c.off(event, callback); | ||
return this; | ||
}; | ||
module.exports = SSH; |
{ | ||
"name": "simple-ssh", | ||
"version": "0.7.4", | ||
"version": "0.8.0", | ||
"description": "A wrapper for ssh2 to make it easier to perform commands over SSH", | ||
@@ -30,4 +30,4 @@ "keywords": [ | ||
"xtend": "~2.0.6", | ||
"ssh2": "~0.2.10" | ||
"ssh2": "~0.3.6" | ||
} | ||
} |
@@ -171,3 +171,3 @@ # simple-ssh | ||
* **options.pty** { _Boolean_ }: Allocates a pseudo-tty, useful for command which require `sudo` (default: `false`) | ||
* **on**( _event_, _callback_ ): **Add a listener for the specified event** (Courtesy of [@alexandrejablon][3]) | ||
* **on**( _event_, _callback_ ): **Add a listener for the specified event** (Courtesy of [@alexjab][3]) | ||
* **event** { _String_ }: Event to listen to | ||
@@ -228,2 +228,2 @@ * **callback** { _Function_ }: Executed on the event | ||
[2]: http://nodejs.org | ||
[3]: https://github.com/alexandrejablon | ||
[3]: https://github.com/alexjab |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24798
500
228
+ Addedasn1@0.2.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.0.27-1(transitive)
+ Addedssh2@0.3.6(transitive)
+ Addedstring_decoder@0.10.31(transitive)
- Removedasn1@0.1.11(transitive)
- Removedssh2@0.2.25(transitive)
Updatedssh2@~0.3.6