allow any kind of stream as input and output. fixes #138.

This commit is contained in:
Christopher Jeffrey 2015-06-09 05:13:11 -07:00
parent 983b5a745a
commit 8228142060
1 changed files with 7 additions and 3 deletions

View File

@ -318,7 +318,7 @@ Program.prototype.listen = function() {
this.on('newListener', function fn(type) {
if (type === 'keypress' || type === 'mouse') {
self.removeListener('newListener', fn);
if (!self.input.isRaw) {
if (self.input.setRawMode && !self.input.isRaw) {
self.input.setRawMode(true);
self.input.resume();
}
@ -3971,13 +3971,17 @@ Program.prototype.pause = function(callback) {
var write = this.output.write;
this.output.write = function() {};
this.input.setRawMode(false);
if (this.input.setRawMode) {
this.input.setRawMode(false);
}
this.input.pause();
return this._resume = function() {
delete self._resume;
self.input.setRawMode(true);
if (self.input.setRawMode) {
self.input.setRawMode(true);
}
self.input.resume();
self.output.write = write;