Skip to content

Commit

Permalink
filter EAGAIN. see #103. comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Mar 7, 2015
1 parent 492b5d9 commit 5bc72bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/pty.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,16 @@ Terminal.prototype.setEncoding = function(enc) {

Terminal.prototype.addListener =
Terminal.prototype.on = function(type, func) {
var self = this;
if (type === 'error') {
this.socket.on(type, function(err) {
if (err && err.message && ~err.message.indexOf('EAGAIN')) {
return;
}
self.emit('error', err);
});
return this;
}
this.socket.on(type, func);
return this;
};
Expand Down
1 change: 1 addition & 0 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ ReadStream.prototype._read = function() {
});
return;
}
// TODO: Use an IO watcher here instead of setTimeout.
if (err || bytesRead === 0) {
setTimeout(function() {
self._read();
Expand Down

0 comments on commit 5bc72bc

Please sign in to comment.